RE: [xsl] Previous/Next element

Subject: RE: [xsl] Previous/Next element
From: "Conal Tuohy" <conalt@xxxxxxxxxxxxxxx>
Date: Thu, 10 Jul 2003 10:37:49 +1200
Hi James. I think I see your problem:

You have:
<a href="{concat('#', $ms, '.', preceding-sibling::*/@code)}">Prev</a>

The expression "preceding-sibling::*/@code" returns the @code attributes of
all preceding sibling elements of the current node, right? Not just the
immediately preceding sibling. Then by implicitly converting this to a
string you are accessing the FIRST such node, in document order (when you
want the last). Try this instead:

preceding-sibling::*[1]/@code

This finds the FIRST preceding sibling (in REVERSE order, because the
preceding-sibling axis is a reverse axis), and then returns ITS code
attribute.

There's a detailed explanation here:
http://www.dpawson.co.uk/xsl/sect2/N1641.html#d1950e19

Cheers!

Con


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread