Wednesday, November 30, 2022
Code Search
Code Bank
.NET Applications
XSD Schema Generator
.NET/XML Training


Sorting XML with the XPathExpression Class

If you’ve worked with XSLT before then you’re more than likely accustomed to using the xsl:sort element when you need to sort strings or numbers within an XML document. This element makes it simple to sort XML data while performing a loop or when calling templates. However, in certain cases when data within an XML document simply needs to be sorted and displayed, XSLT can be overkill. Without using XSLT’s xsl:sort element how can you sort XML data?

This task is actually fairly simple to accomplish in the .NET platform using classes within the System.Xml.XPath namespace such as XPathNavigator and XPathExpression. XPath functionality normally only found in XSLT is exposed by these and several other classes which allows you to navigate through XML documents and even perform sorting operations. This sample application demonstrates how XML data can be sorted using the XPathExpression class.

Teaches XML,XPath
Requirements .NET 1.0
Example: Click Here
View Source Code: Click Here
Download Code: Click Here


.NET, SharePoint and Silverlight Training Solutions
    Online, Onsite and Video Training on .NET and SharePoint technologies available through The Wahlin Group.

© 2007 Wahlin Consulting LLC
XML for ASP.NET Developers in bookstores