Exemplo n.º 1
0
        public override void Evaluate(XslTransformProcessor p)
        {
            if (p.Debugger != null)
            {
                p.Debugger.DebugExecute(p, this.DebugInput);
            }

            p.Out.WriteComment(value == null ? String.Empty :
                               value.EvaluateAsString(p));
        }
        public override void Evaluate(XslTransformProcessor p)
        {
            if (p.Debugger != null)
            {
                p.Debugger.DebugExecute(p, this.DebugInput);
            }

            string nm, nmsp, prefix;

            nm   = calcName != null ? calcName : name.Evaluate(p);
            nmsp = calcNs != null ? calcNs : ns != null?ns.Evaluate(p) : String.Empty;

            prefix = calcPrefix != null ? calcPrefix : String.Empty;

            if (nm == "xmlns")
            {
                // It is an error. We must recover by not emmiting any attributes
                // (unless we throw an exception).
                return;
            }

            int colonAt = nm.IndexOf(':');

            // local attribute
            if (colonAt > 0)
            {
                prefix = nm.Substring(0, colonAt);
                nm     = nm.Substring(colonAt + 1);

                // global attribute
                if (nmsp == String.Empty &&
                    prefix == XmlNamespaceManager.PrefixXml)
                {
                    nmsp = XmlNamespaceManager.XmlnsXml;
                }
                else if (nmsp == String.Empty)
                {
                    nmsp = (string)nsDecls [prefix];
                    if (nmsp == null)
                    {
                        nmsp = String.Empty;
                    }
                }
            }

            if (prefix == "xmlns")
            {
                prefix = String.Empty;  // Should not be allowed.
            }
            XmlConvert.VerifyName(nm);

            p.Out.WriteAttributeString(prefix, nm, nmsp,
                                       value == null ? "" : value.EvaluateAsString(p));
        }
        public override void Evaluate(XslTransformProcessor p)
        {
            if (p.Debugger != null)
            {
                p.Debugger.DebugExecute(p, this.DebugInput);
            }

            if (children != null)
            {
                output.Write(children.EvaluateAsString(p));
            }
            if (terminate)
            {
                throw new XsltException("Transformation terminated.", null, p.CurrentNode);
            }
        }
Exemplo n.º 4
0
        public override void Evaluate(XslTransformProcessor p)
        {
            if (p.Debugger != null)
            {
                p.Debugger.DebugExecute(p, this.DebugInput);
            }

            string actualName = name.Evaluate(p);

            if (String.Compare(actualName, "xml", true, CultureInfo.InvariantCulture) == 0)
            {
                throw new XsltException("Processing instruction name was evaluated to \"xml\"", null, p.CurrentNode);
            }
            if (actualName.IndexOf(':') >= 0)
            {
                return; //MS.NET ignores such processing instructions
            }
            p.Out.WriteProcessingInstruction(actualName,
                                             value == null ? String.Empty :
                                             value.EvaluateAsString(p));
        }