xsl-list
[Top] [All Lists]

Re: [xsl] Problems with following-sibling

2007-07-04 08:17:57
Barret Boombastic wrote:

 <xsl:for-each select="car[name = 'Ferrari Enzo']">
 <xsl:variable name="nextVolume" select="following-sibling::car/volume"/>
   <line x1="{position()*15}" y1="-{volume} " x2="{(position()+1)*15}" y2="-{$nextVolume}" 
style="stroke: red;"/>
</xsl:for-each>
</g>

Here is the problem: When I try to get the "nextVolume" with 
"following-sibling::car/volume" it works fine if the next car is a Ferrari, but as you 
can see the cars can be at any order in the xml-file.
I've selected specifically the Ferraris with the "for-each", but how do I 
select the following sibling so that it also matches the car name?

Can't you simply use the same predicate as before? That is [name = 'Ferrari Enzo'] so

<xsl:for-each select="car[name = 'Ferrari Enzo']">
<xsl:variable name="nextVolume" select="following-sibling::car[name = 'Ferrari Enzo'][1]/volume"/>

should do.

--

        Martin Honnen
        http://JavaScript.FAQTs.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>
--~--

<Prev in Thread] Current Thread [Next in Thread>