|
Subject: Re: [xsl] Sorting seems not to work completely From: "Murray McDonald" <m.mcdonald@xxxxxxxxx> Date: Wed, 27 Jul 2011 15:19:44 -0400 |
Hi Mark,
Try this:
<xsl:template match="List">
<xsl:element name="List">
<xsl:for-each-group select="Item/Stamp" group-by="concat(Date/@year, '
', Date/@month, ' ', Date/@day)">
<xsl:sort select="Date/@year" data-type="number"></xsl:sort>
<xsl:sort select="Date/@month" data-type="number"></xsl:sort>
<xsl:sort select="Date/@day" data-type="number"></xsl:sort>
<!-- output a Date element for each date "group" -->
<xsl:copy-of select="current()/Date"
copy-namespaces="no"></xsl:copy-of>
<xsl:for-each select="current-group()">
<!-- this sorts the elements within each group -->
<xsl:sort select="@value" order="descending"
data-type="number"></xsl:sort>
<!-- this outputs each individual element within the group in
sorted order -->
<xsl:element name="Item">
<xsl:copy-of select="."/>
</xsl:element>
</xsl:for-each>
</xsl:for-each-group>
</xsl:element>
</xsl:template>
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Sorting seems not to work, Michael Kay | Thread | Re: [xsl] Sorting seems not to work, Mark |
| Re: [xsl] Sorting seems not to work, Mark | Date | Re: [xsl] Sorting seems not to work, Andrew Welch |
| Month |