Subject: Re: XSLT 2 - Sorting data with two elements named the same
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Thu, 12 Jun 2008 10:28:58 +0100
|
2008/6/12 Chris Hughes <chris_hughes22@xxxxxxxxxxx>:
> XTTE1020: A sequence of more than one item is not allowed as the @select attribute of xsl:sort.
> <Person name="Chris">
> <Rating type="Adjusted" value="100">
> <Rating type="Actual" value="99.6">
> </Person>
> <Person name="John">
> <Rating type="Adjusted" value="95">
> <Rating type="Actual" value="97.6">
> </Person>
> <Person name="Dave">
> <Rating type="Adjusted" value="90">
> <Rating type="Actual" value="81.6">
> </Person>
> <xsl:variable name="sortedratings">
> <xsl:for-each select="Person[Rating/@type = 'Adjusted']">
> <xsl:sort select="Rating/@value" data-type="number" order="descending"/>
> <xsl:copy-of select="."/>
> </xsl:for-each>
> </xsl:variable>
> So my question is how can I sort this data just by the one adjusted Rating element, and still have access to the partent node.
Isn't it just:
<xsl:sort select="Rating[@type = 'Adjusted']/@value" ....
?
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
|