xsl-list
[Top] [All Lists]

Re: [xsl] XSLT 2 - Sorting data with two elements named the same

2008-06-12 02:29:22
2008/6/12 Chris Hughes <chris_hughes22(_at_)yahoo(_dot_)co(_dot_)uk>:

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[(_at_)type = 'Adjusted']/@value" ....

?



-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
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>