<xsl:sort select="index-of($sortorder, @ID)"/>
where
<xsl:variable name="sortorder"
select="for $t in tokenize(/source/sortorder, ',\s*') return
xs:integer($t)"/>
This isn't going to be very efficient if sortorder is a long list, in that
case you probably want to use keys to speed it up.
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: marentxml [mailto:mailing(_dot_)lists(_at_)marentxml(_dot_)ch]
Sent: 20 May 2008 07:17
To: Xsl-List
Subject: [xsl] sort by predefined order
hi
is there any way to sort elements by a predefined order? i'd
like to come from
<source>
<sortorder>46, 21, 39, 27, 17</sortorder>
<elements>
<element ID="17"/>
<element ID="21"/>
<element ID="27"/>
<element ID="39"/>
<element ID="46"/>
</elements>
</source>
the most elegant way to
<target>
<elements>
<element ID="46"/>
<element ID="21"/>
<element ID="39"/>
<element ID="27"/>
<element ID="17"/>
</elements>
</target>
thanks in advance for any help.
frank
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--