Re: [xsl] order as defined in the sequence

Subject: Re: [xsl] order as defined in the sequence
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 23 May 2007 14:08:46 +0100
> Is there any possibility to set the order of the selected nodes as defined
> in the sequence. I.E.

Just as you hav eused the comma operator to order eth sequence of
strings you could use it to order a sequence of nodes:


<xsl:for-each select="node[@class = 'z'],node[@class = 'a'],node[@class = 'b']">

I'm assuming the leading / in /node[@class = ('z', 'a', 'b')] was a
typo since in a well formed document there can only be one element node
below / (although XDM allows more than one).

Of course if the sequence ('z', 'a', 'b') is at all regular, or even if
it is not,  it is probably more convenient to view this as a sorting operation

<xsl:for-each select="node">
  <xsl:sort select="index-of(('z', 'a', 'b'),@class)"/>

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread