xsl-list
[Top] [All Lists]

Re: <xsl:sort>

2005-05-07 01:31:21
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>