Exemplo n.º 1
0
        public override void Evaluate(XslTransformProcessor p)
        {
            if (p.Debugger != null)
            {
                p.Debugger.DebugExecute(p, base.DebugInput);
            }
            string           text             = (this.calcName == null) ? this.name.Evaluate(p) : this.calcName;
            string           text2            = (this.calcNs == null) ? ((this.ns == null) ? null : this.ns.Evaluate(p)) : this.calcNs;
            XmlQualifiedName xmlQualifiedName = XslNameUtil.FromString(text, this.nsDecls);
            string           text3            = xmlQualifiedName.Name;

            if (text2 == null)
            {
                text2 = xmlQualifiedName.Namespace;
            }
            int num = text.IndexOf(':');

            if (num > 0)
            {
                this.calcPrefix = text.Substring(0, num);
            }
            else if (num == 0)
            {
                XmlConvert.VerifyNCName(string.Empty);
            }
            string text4 = (this.calcPrefix == null) ? string.Empty : this.calcPrefix;

            if (text4 != string.Empty)
            {
                XmlConvert.VerifyNCName(text4);
            }
            XmlConvert.VerifyNCName(text3);
            bool insideCDataElement = p.InsideCDataElement;

            p.PushElementState(text4, text3, text2, false);
            p.Out.WriteStartElement(text4, text3, text2);
            if (this.useAttributeSets != null)
            {
                foreach (XmlQualifiedName xmlQualifiedName2 in this.useAttributeSets)
                {
                    p.ResolveAttributeSet(xmlQualifiedName2).Evaluate(p);
                }
            }
            if (this.value != null)
            {
                this.value.Evaluate(p);
            }
            if (this.isEmptyElement && this.useAttributeSets == null)
            {
                p.Out.WriteEndElement();
            }
            else
            {
                p.Out.WriteFullEndElement();
            }
            p.PopCDataState(insideCDataElement);
        }
Exemplo n.º 2
0
        public override void Evaluate(XslTransformProcessor p)
        {
            if (p.Debugger != null)
            {
                p.Debugger.DebugExecute(p, this.DebugInput);
            }

            string nm, nmsp, localName, prefix;

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

            QName q = XslNameUtil.FromString(nm, nsDecls);

            localName = q.Name;
            if (nmsp == null)
            {
                nmsp = q.Namespace;
            }
            int colonAt = nm.IndexOf(':');

            if (colonAt > 0)
            {
                calcPrefix = nm.Substring(0, colonAt);
            }
            else if (colonAt == 0)
            {
                // raises an error
                XmlConvert.VerifyNCName(String.Empty);
            }

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

            if (prefix != String.Empty)
            {
                XmlConvert.VerifyNCName(prefix);
            }
            XmlConvert.VerifyNCName(localName);

            bool isCData = p.InsideCDataElement;

            p.PushElementState(prefix, localName, nmsp, false);
            p.Out.WriteStartElement(prefix, localName, nmsp);

            if (useAttributeSets != null)
            {
                foreach (XmlQualifiedName s in useAttributeSets)
                {
                    p.ResolveAttributeSet(s).Evaluate(p);
                }
            }

            if (value != null)
            {
                value.Evaluate(p);
            }

            if (isEmptyElement && useAttributeSets == null)
            {
                p.Out.WriteEndElement();
            }
            else
            {
                p.Out.WriteFullEndElement();
            }
            p.PopCDataState(isCData);
        }