xsl-list
[Top] [All Lists]

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

2008-06-12 02:24:39
I'm using XSLT 2, and Saxon 9.0.0.6.
 
I am recieveing the following error message
 
XTTE1020: A sequence of more than one item is not allowed as the @select 
attribute of xsl:sort.
 
I understand why I have this message, my post is simply how can I make this 
work, my data is structured like so
 
<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>
....
 
I appreciate there is no logic to this data, its just an example as I can't 
post my real data ;)
I want to sort the data by the Adjusted rating only, and then output a list of 
adjusted ratings followed by the person name i.e.
 
100 Chris, 95 John, Dave 90 .....etc
 
So my XSL is currently trying the load the data into a variable which is when I 
receive the error message
 
                <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>
 
I then go onto work with this 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.
 
Thanks.


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html

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