This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem with last() function



> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]