This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: problem with last() function
- From: David Carlisle <davidc at nag dot co dot uk>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Thu, 30 May 2002 15:31:35 +0100
- Subject: Re: [xsl] problem with last() function
- References: <3CF631A5.2080005@yahoo.es>
- Reply-to: xsl-list at lists dot mulberrytech dot com
> I've had to use "self::node()[position()=last()]" instead of simply
the step self::node() constructs a current node list with exactly one
element so position() and last() will always be 1, so position()=last()
is always true().
so "self::node()[position()=last()]" is equivalent to self::node()
As you are using this is a boolean context it is true as self::node() is
always non empty, and as | is effectively or-ing together the boolean
values,
<xsl:if test="following-sibling::table |
following-sibling:list | self::node()[position()=last()]">
is equivalent to <xsl:if test="true()">
which is equivalent to ""
I _think_ you want the test to be true just in the case that the only
following nodes (if there are any) are table or list, in which case
that is
<xsl:test="not(following-sibling::node()[not(self::table or self::list)])">
Note if you use node() then all nodes will be tested including any white
space nodes between the elements. If you only want to test following
elements then use * not node()
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list