I heard of importing your xml doc into a dataset, then sort the
dataset and re-populate your xml, but I'm not sure how to code this or
is there another way of sorting a XML file? I not familiar with
Dataset coding and how that would work.
Here is my XML file:
?xml version="1.0"?>
<IndividualListing>
<Individual>
<Name>Aaron, Scott</Name>
<Pager>3122220365@archwireless.net</Pager>
</Individual>
<Individual>
<Name>Boston, Jeff</Name>
<Pager>6152257514@archwireless.net</Pager>
</Individual>
<Individual>
<Name>Adams, Ryan</Name>
<Pager>2129410781@archwireless.net</Pager>
</Individual>
<Individual>
<Name>Thomas, Naveed</Name>
<Pager>6159416077@archwireless.net</Pager>
</Individual>
<Individual>
<Name>Baker, Srinivas</Name>
<Pager>3122010073@archwireless.net</Pager>
</Individual>
<Individual>
<Name>Wilson, Don</Name>
<Pager>8472222016@archwireless.net</Pager>
</Individual>
<Individual>
<Name>Naveed Reddy</Name>
<Pager>3122225858@archwireless.net</Pager>
</Individual>
<Individual>
<Name>Sanders, William</Name>
<Pager>3122224506@archwireless.net</Pager>
</Individual>
<Individual>
<Name>Anderson, Karl R.</Name>
<Pager>3122051023@archwireless.net</Pager>
</Individual>
</IndividualListing>
thanks
Martin Honnen - 23 Apr 2007 13:18 GMT
> I heard of importing your xml doc into a dataset, then sort the
> dataset and re-populate your xml, but I'm not sure how to code this or
[quoted text clipped - 8 lines]
> <Pager>3122220365@archwireless.net</Pager>
> </Individual>
Here is an XSLT stylesheet that sorts your Individual elements on the
Name child elements:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="IndividualListing">
<xsl:copy>
<xsl:apply-templates select="Individual">
<xsl:sort select="Name" data-type="text"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Result then starts like this
<IndividualListing>
<Individual>
<Name>Aaron, Scott</Name>
<Pager>3122220365@archwireless.net</Pager>
</Individual>
<Individual>
<Name>Adams, Ryan</Name>
<Pager>2129410781@archwireless.net</Pager>
</Individual>
<Individual>
<Name>Anderson, Karl R.</Name>
<Pager>3122051023@archwireless.net</Pager>
</Individual>
You can run XSLT stylesheets from inside Visual Studio 2005 or with .NET
code where you use System.Xml.Xsl.XslCompiledTransform with .NET 2.0.
See
<http://msdn2.microsoft.com/en-us/library/system.xml.xsl.xslcompiledtransform.aspx>
VB.NET example is as easy as
Dim xslt As New XslCompiledTransform()
xslt.Load("stylesheet.xsl")
' Execute the transform and output the results to a file.
xslt.Transform("file.xml", "sorted.xml")

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Susie DBA [MSFT] - 23 Apr 2007 20:07 GMT
If I were you.. I would keep your DATA in a DATABASE and screw XML in
the nose
> richardkre...@northwesternmutual.com wrote:
> > I heard of importing your xml doc into a dataset, then sort the
[quoted text clipped - 64 lines]
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/