RE: [xsl] again position()?

Subject: RE: [xsl] again position()?
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 20 Jun 2001 13:19:40 +0100
> at first: thanks for all earlier answers -- i'll try to use them
> later.. i'm doing my xsl pages after hours, so i don't have much
> time for it the more it's not so intuitive language :-)

I'm afraid that using your own not-so-intuitive language instead isn't going
to help you communicate....
>
> i'd like to ask for a solution for such test:
>    if ((current("part") == 1) && (current("chapter") == 1))
>       intro="true";
> in xslt.
>
> by current() i mean a function which returns current
> position of a tag in xpath tree.

I suspect that you want your current("part") function (not to be confused
with the XSLT current() function) to return something like
count(ancestor::part/preceding-sibling::* + 1).

But if you're only testing the result against 1, then you're testing to see
if the element has any preceding siblings, which you can write as:

<xsl:if test="not(ancestor::part/preceding-sibling::* or
ancestor::chapter/preceding-sibling::*)">

Mike Kay
Software AG


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


Current Thread