Esempio 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);
        }
Esempio n. 2
0
        public override void Evaluate(XslTransformProcessor p)
        {
            if (p.Debugger != null)
            {
                p.Debugger.DebugExecute(p, this.DebugInput);
            }

            // Since namespace-alias might be determined after compilation
            // of import-ing stylesheets, this must be determined later.
            bool isCData = p.InsideCDataElement;

            p.PushElementState(prefix, localname, nsUri, true);
            p.Out.WriteStartElement(prefix, localname, nsUri);

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

            if (attrs != null)
            {
                int len = attrs.Count;
                for (int i = 0; i < len; i++)
                {
                    ((XslLiteralAttribute)attrs [i]).Evaluate(p);
                }
            }

            p.OutputLiteralNamespaceUriNodes(nsDecls, null, null);

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

            var templateContent = children as XslTemplateContent;

            if (isEmptyElement || (templateContent != null && templateContent.IsEmptyElement))
            {
                p.Out.WriteEndElement();
            }
            else
            {
                p.Out.WriteFullEndElement();
            }

            p.PopCDataState(isCData);
        }
        public override void Evaluate(XslTransformProcessor p)
        {
            if (p.Debugger != null)
            {
                p.Debugger.DebugExecute(p, base.DebugInput);
            }
            bool insideCDataElement = p.InsideCDataElement;

            p.PushElementState(this.prefix, this.localname, this.nsUri, true);
            p.Out.WriteStartElement(this.prefix, this.localname, this.nsUri);
            if (this.useAttributeSets != null)
            {
                foreach (XmlQualifiedName name in this.useAttributeSets)
                {
                    p.ResolveAttributeSet(name).Evaluate(p);
                }
            }
            if (this.attrs != null)
            {
                int count = this.attrs.Count;
                for (int j = 0; j < count; j++)
                {
                    ((XslLiteralElement.XslLiteralAttribute) this.attrs[j]).Evaluate(p);
                }
            }
            p.OutputLiteralNamespaceUriNodes(this.nsDecls, null, null);
            if (this.children != null)
            {
                this.children.Evaluate(p);
            }
            if (this.isEmptyElement)
            {
                p.Out.WriteEndElement();
            }
            else
            {
                p.Out.WriteFullEndElement();
            }
            p.PopCDataState(insideCDataElement);
        }
Esempio n. 4
0
		public override void Evaluate (XslTransformProcessor p)
		{
			if (p.Debugger != null)
				p.Debugger.DebugExecute (p, this.DebugInput);

			XPathNavigator nav = p.CurrentNode;
			switch (nav.NodeType)
			{
			case XPathNodeType.Root:
				if (p.Out.CanProcessAttributes && useAttributeSets != null)
					foreach (XmlQualifiedName s in useAttributeSets) {
						XslAttributeSet attset = p.ResolveAttributeSet (s);
						if (attset == null)
							throw new XsltException ("Attribute set was not found", null, nav);
						attset.Evaluate (p);
					}

				if (children != null) children.Evaluate (p);
				break;
			case XPathNodeType.Element:
				bool isCData = p.InsideCDataElement;
				string prefix = nav.Prefix;
				p.PushElementState (prefix, nav.LocalName, nav.NamespaceURI, true);
				p.Out.WriteStartElement (prefix, nav.LocalName, nav.NamespaceURI);
				
				if (useAttributeSets != null)
					foreach (XmlQualifiedName s in useAttributeSets)
						p.ResolveAttributeSet (s).Evaluate (p);

				if (nav.MoveToFirstNamespace (XPathNamespaceScope.ExcludeXml)) {
					do {
						if (nav.LocalName == prefix)
							continue;
						p.Out.WriteNamespaceDecl (nav.LocalName, nav.Value);
					} while (nav.MoveToNextNamespace (XPathNamespaceScope.ExcludeXml));
					nav.MoveToParent ();
				}

				if (children != null) children.Evaluate (p);

				p.Out.WriteFullEndElement ();
				p.PopCDataState (isCData);
				break;
			case XPathNodeType.Attribute:
				p.Out.WriteAttributeString (nav.Prefix, nav.LocalName, nav.NamespaceURI, nav.Value);
				break;
			
			case XPathNodeType.SignificantWhitespace:
			case XPathNodeType.Whitespace:
				bool cdata = p.Out.InsideCDataSection;
				p.Out.InsideCDataSection = false;
				p.Out.WriteString (nav.Value);
				p.Out.InsideCDataSection = cdata;
				break;
			case XPathNodeType.Text:
				p.Out.WriteString (nav.Value);
				break;
			
			case XPathNodeType.Comment:
				p.Out.WriteComment (nav.Value);
				break;
			
			case XPathNodeType.ProcessingInstruction:
				p.Out.WriteProcessingInstruction (nav.Name, nav.Value);
				break;

			case XPathNodeType.Namespace:
				if (p.XPathContext.ElementPrefix != nav.Name)
					p.Out.WriteNamespaceDecl (nav.Name, nav.Value);
				break;

			default:
//				Console.WriteLine ("unhandled node type {0}", nav.NodeType);
				break;
			}
		}
        void CopyNode(XslTransformProcessor p, XPathNavigator nav)
        {
            Outputter outputter = p.Out;

            switch (nav.NodeType)
            {
            case XPathNodeType.Root:
                XPathNodeIterator itr = nav.SelectChildren(XPathNodeType.All);
                while (itr.MoveNext())
                {
                    CopyNode(p, itr.Current);
                }
                break;

            case XPathNodeType.Element:
                bool   isCData = p.InsideCDataElement;
                string prefix  = nav.Prefix;
                string ns      = nav.NamespaceURI;
                p.PushElementState(prefix, nav.LocalName, ns, false);
                outputter.WriteStartElement(prefix, nav.LocalName, ns);

                if (nav.MoveToFirstNamespace(XPathNamespaceScope.ExcludeXml))
                {
                    do
                    {
                        if (prefix == nav.Name)
                        {
                            continue;
                        }
                        if (nav.Name.Length == 0 && ns.Length == 0)
                        {
                            continue;
                        }
                        outputter.WriteNamespaceDecl(nav.Name, nav.Value);
                    }while (nav.MoveToNextNamespace(XPathNamespaceScope.ExcludeXml));
                    nav.MoveToParent();
                }

                if (nav.MoveToFirstAttribute())
                {
                    do
                    {
                        outputter.WriteAttributeString(nav.Prefix, nav.LocalName, nav.NamespaceURI, nav.Value);
                    }while (nav.MoveToNextAttribute());
                    nav.MoveToParent();
                }

                if (nav.MoveToFirstChild())
                {
                    do
                    {
                        CopyNode(p, nav);
                    }while (nav.MoveToNext());
                    nav.MoveToParent();
                }

                if (nav.IsEmptyElement)
                {
                    outputter.WriteEndElement();
                }
                else
                {
                    outputter.WriteFullEndElement();
                }

                p.PopCDataState(isCData);
                break;

            case XPathNodeType.Namespace:
                if (nav.Name != p.XPathContext.ElementPrefix &&
                    (p.XPathContext.ElementNamespace.Length > 0 || nav.Name.Length > 0))
                {
                    outputter.WriteNamespaceDecl(nav.Name, nav.Value);
                }
                break;

            case XPathNodeType.Attribute:
                outputter.WriteAttributeString(nav.Prefix, nav.LocalName, nav.NamespaceURI, nav.Value);
                break;

            case XPathNodeType.Whitespace:
            case XPathNodeType.SignificantWhitespace:
                bool cdata = outputter.InsideCDataSection;
                outputter.InsideCDataSection = false;
                outputter.WriteString(nav.Value);
                outputter.InsideCDataSection = cdata;
                break;

            case XPathNodeType.Text:
                outputter.WriteString(nav.Value);
                break;

            case XPathNodeType.ProcessingInstruction:
                outputter.WriteProcessingInstruction(nav.Name, nav.Value);
                break;

            case XPathNodeType.Comment:
                outputter.WriteComment(nav.Value);
                break;
            }
        }
Esempio n. 6
0
        public override void Evaluate(XslTransformProcessor p)
        {
            if (p.Debugger != null)
            {
                p.Debugger.DebugExecute(p, this.DebugInput);
            }

            XPathNavigator nav = p.CurrentNode;

            switch (nav.NodeType)
            {
            case XPathNodeType.Root:
                if (p.Out.CanProcessAttributes && useAttributeSets != null)
                {
                    foreach (XmlQualifiedName s in useAttributeSets)
                    {
                        XslAttributeSet attset = p.ResolveAttributeSet(s);
                        if (attset == null)
                        {
                            throw new XsltException("Attribute set was not found", null, nav);
                        }
                        attset.Evaluate(p);
                    }
                }

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

            case XPathNodeType.Element:
                bool   isCData = p.InsideCDataElement;
                string prefix  = nav.Prefix;
                p.PushElementState(prefix, nav.LocalName, nav.NamespaceURI, true);
                p.Out.WriteStartElement(prefix, nav.LocalName, nav.NamespaceURI);

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

                if (nav.MoveToFirstNamespace(XPathNamespaceScope.ExcludeXml))
                {
                    do
                    {
                        if (nav.LocalName == prefix)
                        {
                            continue;
                        }
                        p.Out.WriteNamespaceDecl(nav.LocalName, nav.Value);
                    } while (nav.MoveToNextNamespace(XPathNamespaceScope.ExcludeXml));
                    nav.MoveToParent();
                }

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

                p.Out.WriteFullEndElement();
                p.PopCDataState(isCData);
                break;

            case XPathNodeType.Attribute:
                p.Out.WriteAttributeString(nav.Prefix, nav.LocalName, nav.NamespaceURI, nav.Value);
                break;

            case XPathNodeType.SignificantWhitespace:
            case XPathNodeType.Whitespace:
                bool cdata = p.Out.InsideCDataSection;
                p.Out.InsideCDataSection = false;
                p.Out.WriteString(nav.Value);
                p.Out.InsideCDataSection = cdata;
                break;

            case XPathNodeType.Text:
                p.Out.WriteString(nav.Value);
                break;

            case XPathNodeType.Comment:
                p.Out.WriteComment(nav.Value);
                break;

            case XPathNodeType.ProcessingInstruction:
                p.Out.WriteProcessingInstruction(nav.Name, nav.Value);
                break;

            case XPathNodeType.Namespace:
                if (p.XPathContext.ElementPrefix != nav.Name)
                {
                    p.Out.WriteNamespaceDecl(nav.Name, nav.Value);
                }
                break;

            default:
//				Console.WriteLine ("unhandled node type {0}", nav.NodeType);
                break;
            }
        }
Esempio n. 7
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);
        }
Esempio n. 8
0
		void CopyNode (XslTransformProcessor p, XPathNavigator nav)
		{
			Outputter outputter = p.Out;
			switch (nav.NodeType) {
			case XPathNodeType.Root:
				XPathNodeIterator itr = nav.SelectChildren (XPathNodeType.All);
				while (itr.MoveNext ())
					CopyNode (p, itr.Current);
				break;
				
			case XPathNodeType.Element:
				bool isCData = p.InsideCDataElement;
				string prefix = nav.Prefix;
				string ns = nav.NamespaceURI;
				p.PushElementState (prefix, nav.LocalName, ns, false);
				outputter.WriteStartElement (prefix, nav.LocalName, ns);
				
				if (nav.MoveToFirstNamespace (XPathNamespaceScope.ExcludeXml))
				{
					do {
						if (prefix == nav.Name)
							continue;
						if (nav.Name.Length == 0 && ns.Length == 0)
							continue;
						outputter.WriteNamespaceDecl (nav.Name, nav.Value);
					} while (nav.MoveToNextNamespace (XPathNamespaceScope.ExcludeXml));
					nav.MoveToParent ();
				}
				
				if (nav.MoveToFirstAttribute())
				{
					do {
						outputter.WriteAttributeString (nav.Prefix, nav.LocalName, nav.NamespaceURI, nav.Value);
					} while (nav.MoveToNextAttribute ());
					nav.MoveToParent();
				}
				
				if (nav.MoveToFirstChild ()) {
					do {
						CopyNode (p, nav);
					} while (nav.MoveToNext ());
					nav.MoveToParent ();
				}

				if (nav.IsEmptyElement)
					outputter.WriteEndElement ();
				else
					outputter.WriteFullEndElement ();

				p.PopCDataState (isCData);
				break;
				
			case XPathNodeType.Namespace:
				if (nav.Name != p.XPathContext.ElementPrefix &&
					(p.XPathContext.ElementNamespace.Length > 0 || nav.Name.Length > 0))
					outputter.WriteNamespaceDecl (nav.Name, nav.Value);
				break;
			case XPathNodeType.Attribute:
				outputter.WriteAttributeString (nav.Prefix, nav.LocalName, nav.NamespaceURI, nav.Value);
				break;
			case XPathNodeType.Whitespace:
			case XPathNodeType.SignificantWhitespace:
				bool cdata = outputter.InsideCDataSection;
				outputter.InsideCDataSection = false;
				outputter.WriteString (nav.Value);
				outputter.InsideCDataSection = cdata;
				break;
			case XPathNodeType.Text:
				outputter.WriteString (nav.Value);
				break;
			case XPathNodeType.ProcessingInstruction:
				outputter.WriteProcessingInstruction (nav.Name, nav.Value);
				break;
			case XPathNodeType.Comment:
				outputter.WriteComment (nav.Value);
				break;
			}			
		}
Esempio n. 9
0
		public override void Evaluate (XslTransformProcessor p)
		{
			if (p.Debugger != null)
				p.Debugger.DebugExecute (p, this.DebugInput);

			// Since namespace-alias might be determined after compilation
			// of import-ing stylesheets, this must be determined later.
			bool isCData = p.InsideCDataElement;
			p.PushElementState (prefix, localname, nsUri, true);
			p.Out.WriteStartElement (prefix, localname, nsUri);

			if (useAttributeSets != null)
				foreach (XmlQualifiedName s in useAttributeSets)
					p.ResolveAttributeSet (s).Evaluate (p);
						
			if (attrs != null) {
				int len = attrs.Count;
				for (int i = 0; i < len; i++)
					((XslLiteralAttribute)attrs [i]).Evaluate (p);
			}

			p.OutputLiteralNamespaceUriNodes (nsDecls, null, null);

			if (children != null) children.Evaluate (p);

			var templateContent = children as XslTemplateContent;
			if (isEmptyElement || (templateContent != null && templateContent.IsEmptyElement))
				p.Out.WriteEndElement ();
			else
				p.Out.WriteFullEndElement ();

			p.PopCDataState (isCData);
		}
Esempio n. 10
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);
		}
Esempio n. 11
0
        private void CopyNode(XslTransformProcessor p, XPathNavigator nav)
        {
            Outputter @out = p.Out;

            switch (nav.NodeType)
            {
            case XPathNodeType.Root:
            {
                XPathNodeIterator xpathNodeIterator = nav.SelectChildren(XPathNodeType.All);
                while (xpathNodeIterator.MoveNext())
                {
                    XPathNavigator nav2 = xpathNodeIterator.Current;
                    this.CopyNode(p, nav2);
                }
                break;
            }

            case XPathNodeType.Element:
            {
                bool   insideCDataElement = p.InsideCDataElement;
                string prefix             = nav.Prefix;
                string namespaceURI       = nav.NamespaceURI;
                p.PushElementState(prefix, nav.LocalName, namespaceURI, false);
                @out.WriteStartElement(prefix, nav.LocalName, namespaceURI);
                if (nav.MoveToFirstNamespace(XPathNamespaceScope.ExcludeXml))
                {
                    do
                    {
                        if (!(prefix == nav.Name))
                        {
                            if (nav.Name.Length != 0 || namespaceURI.Length != 0)
                            {
                                @out.WriteNamespaceDecl(nav.Name, nav.Value);
                            }
                        }
                    }while (nav.MoveToNextNamespace(XPathNamespaceScope.ExcludeXml));
                    nav.MoveToParent();
                }
                if (nav.MoveToFirstAttribute())
                {
                    do
                    {
                        @out.WriteAttributeString(nav.Prefix, nav.LocalName, nav.NamespaceURI, nav.Value);
                    }while (nav.MoveToNextAttribute());
                    nav.MoveToParent();
                }
                if (nav.MoveToFirstChild())
                {
                    do
                    {
                        this.CopyNode(p, nav);
                    }while (nav.MoveToNext());
                    nav.MoveToParent();
                }
                if (nav.IsEmptyElement)
                {
                    @out.WriteEndElement();
                }
                else
                {
                    @out.WriteFullEndElement();
                }
                p.PopCDataState(insideCDataElement);
                break;
            }

            case XPathNodeType.Attribute:
                @out.WriteAttributeString(nav.Prefix, nav.LocalName, nav.NamespaceURI, nav.Value);
                break;

            case XPathNodeType.Namespace:
                if (nav.Name != p.XPathContext.ElementPrefix && (p.XPathContext.ElementNamespace.Length > 0 || nav.Name.Length > 0))
                {
                    @out.WriteNamespaceDecl(nav.Name, nav.Value);
                }
                break;

            case XPathNodeType.Text:
                @out.WriteString(nav.Value);
                break;

            case XPathNodeType.SignificantWhitespace:
            case XPathNodeType.Whitespace:
            {
                bool insideCDataSection = @out.InsideCDataSection;
                @out.InsideCDataSection = false;
                @out.WriteString(nav.Value);
                @out.InsideCDataSection = insideCDataSection;
                break;
            }

            case XPathNodeType.ProcessingInstruction:
                @out.WriteProcessingInstruction(nav.Name, nav.Value);
                break;

            case XPathNodeType.Comment:
                @out.WriteComment(nav.Value);
                break;
            }
        }
Esempio n. 12
0
        public override void Evaluate(XslTransformProcessor p)
        {
            if (p.Debugger != null)
            {
                p.Debugger.DebugExecute(p, base.DebugInput);
            }
            XPathNavigator currentNode = p.CurrentNode;

            switch (currentNode.NodeType)
            {
            case XPathNodeType.Root:
                if (p.Out.CanProcessAttributes && this.useAttributeSets != null)
                {
                    foreach (XmlQualifiedName name in this.useAttributeSets)
                    {
                        XslAttributeSet xslAttributeSet = p.ResolveAttributeSet(name);
                        if (xslAttributeSet == null)
                        {
                            throw new XsltException("Attribute set was not found", null, currentNode);
                        }
                        xslAttributeSet.Evaluate(p);
                    }
                }
                if (this.children != null)
                {
                    this.children.Evaluate(p);
                }
                break;

            case XPathNodeType.Element:
            {
                bool   insideCDataElement = p.InsideCDataElement;
                string prefix             = currentNode.Prefix;
                p.PushElementState(prefix, currentNode.LocalName, currentNode.NamespaceURI, true);
                p.Out.WriteStartElement(prefix, currentNode.LocalName, currentNode.NamespaceURI);
                if (this.useAttributeSets != null)
                {
                    foreach (XmlQualifiedName name2 in this.useAttributeSets)
                    {
                        p.ResolveAttributeSet(name2).Evaluate(p);
                    }
                }
                if (currentNode.MoveToFirstNamespace(XPathNamespaceScope.ExcludeXml))
                {
                    do
                    {
                        if (!(currentNode.LocalName == prefix))
                        {
                            p.Out.WriteNamespaceDecl(currentNode.LocalName, currentNode.Value);
                        }
                    }while (currentNode.MoveToNextNamespace(XPathNamespaceScope.ExcludeXml));
                    currentNode.MoveToParent();
                }
                if (this.children != null)
                {
                    this.children.Evaluate(p);
                }
                p.Out.WriteFullEndElement();
                p.PopCDataState(insideCDataElement);
                break;
            }

            case XPathNodeType.Attribute:
                p.Out.WriteAttributeString(currentNode.Prefix, currentNode.LocalName, currentNode.NamespaceURI, currentNode.Value);
                break;

            case XPathNodeType.Namespace:
                if (p.XPathContext.ElementPrefix != currentNode.Name)
                {
                    p.Out.WriteNamespaceDecl(currentNode.Name, currentNode.Value);
                }
                break;

            case XPathNodeType.Text:
                p.Out.WriteString(currentNode.Value);
                break;

            case XPathNodeType.SignificantWhitespace:
            case XPathNodeType.Whitespace:
            {
                bool insideCDataSection = p.Out.InsideCDataSection;
                p.Out.InsideCDataSection = false;
                p.Out.WriteString(currentNode.Value);
                p.Out.InsideCDataSection = insideCDataSection;
                break;
            }

            case XPathNodeType.ProcessingInstruction:
                p.Out.WriteProcessingInstruction(currentNode.Name, currentNode.Value);
                break;

            case XPathNodeType.Comment:
                p.Out.WriteComment(currentNode.Value);
                break;
            }
        }