|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: <xsl:sort>
Thanks for the reply, George. I gave your suggestion a try, but it still does not affect the sort order of <product> elements. In the resultant document, they continue to appear in the orginal XML document order. Respectfully, ASP -----Original Message----- From: George Cristian Bina [mailto:george@xxxxxxx] Sent: Saturday, May 07, 2005 4:13 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: <xsl:sort> Hi, You select only one node (the current node that is a product element) and apply templates on it sorting this set (of one node) according with your criteria. Something like below may behave as you expect: <xsl:template match="document"> <xsl:for-each select="child::node()"> <!-- whatever processing you want to do --> </xsl:for-each> <xsl:apply-templates select="product"> <xsl:sort select="category" data-type="number" order="descending"/> </xsl:apply-templates> </xsl:template> Best Regards, George --------------------------------------------------------------------- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com aspsa wrote: > Hi, folks. > > I have an XML document which structure is the following: > > <document> > <header> > <paragraph> > <subheader> > <paragraph> > . > . > . > <product> > <partname> > <category> > . > . > . > </product> > <product> > <partname> > <category> > . > . > . > </product> > . > . > . > </document> > > In a template that matches on "document", I have the following: > > <xsl:template match="document"> > <xsl:for-each select="child::node()"> > // etc... > </xsl:for-each> > </xsl:template> > > The XSLT stylesheet works fine, but now I need to sort the "product" > elements based upon the "category" element and in descending order. The > category content is numeric. > > How would I execute this from within the "document" template? > > Here's what I've tried. > > <xsl:template match="document"> > <xsl:for-each select="child::node()"> > <xsl:if test="product"> > <xsl:apply-templates select="."> > <xsl:sort select="category" data-type="number" order="descending" /> > </xsl:apply-templates> > </xsl:if> > </xsl:for-each> > </xsl:template> > > Where am I going wrong? Thanks for your feedback. > > > Respectfully, > > ASP
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








