[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: <xsl:sort>

Subject: Re: <xsl:sort>
From: George Cristian Bina <george@xxxxxxx>
Date: Sat, 07 May 2005 11:31:21 +0300
xsl sort .net 2005
XML:
<?xml version="1.0" encoding="UTF-8"?>
<document>
    <header/>
    <paragraph/>
    <subheader/>
    <paragraph/>
    <product>
        <partname/>
        <category>3</category>
    </product>
    <product>
        <partname/>
        <category>1</category>
    </product>
    <product>
        <partname/>
        <category>2</category>
    </product>
</document>

XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<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>
</xsl:stylesheet>


All the XSLT transformers I tried (Saxon6.5.3, Saxon 8.4, Xalan 2.5.1, MSXML .NET, 4.0, 3.0 and XSLTProc) gave me:
3
2
1


Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


aspsa wrote:
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.