Subject: RE: [xsl] <xsl:sort> From: "Aron Bock" <aronbock@xxxxxxxxxxx> Date: Sat, 07 May 2005 08:33:34 +0000 |
<xsl:template match="document"> <xsl:value-of: ...header <xsl:value-of: ...subheader
<xsl:apply-templates select="product"> <xsl:sort select="."/> /end-product /end-document
<xsl:template match="product" ... /end-product
From: aspsa <aspsa@xxxxxxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] <xsl:sort> Date: Sat, 07 May 2005 03:37:44 -0400
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] <xsl:sort>, George Cristian Bina | Thread | RE: [xsl] <xsl:sort>, aspsa |
Re: [xsl] <xsl:sort>, George Cristian Bina | Date | Re: [xsl] Building Dynamic Urls, Aron Bock |
Month |