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