2008/5/20 Michael Kay <mike(_at_)saxonica(_dot_)com>:
<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.
I would've tended towards that route anyway - not using sort at all.
So modifying the above a bit you get:
<xsl:key name="element-by-ID" match="element" use="@ID"/>
<xsl:for-each select="for $t in tokenize(/source/sortorder, ',\s*')
return xs:integer($t)">
<xsl:apply-templates select="key('element-by-ID', .)"/>
</xsl:for-each>
or perhaps
<xsl:apply-templates select="for $t in tokenize(/source/sortorder,
',\s*') return key('element-by-ID', xs:integer($t))"/>
--
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>
--~--