This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Position of parent node
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] Re: Position of parent node
- From: Dimitre Novatchev <dnovatchev at yahoo dot com>
- Date: Tue, 5 Jun 2001 06:32:53 -0700 (PDT)
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Athanasios ,
> Inside the <xsl:template match="b">
> I would like to do the following check:
>
> If the position of <p> within <q> is the last one
> do thing with <b>
> else
> do other with <b>
Your question is not sufficiently specific -- "the position of <p> within
<q>" -- but relative to which nodelist??? Will you count only the <p> nodes?
Or maybe you'll count also other siblings of "p" (e.g. text nodes)?
In the two situations above the values for "position" will be different!
I'm assuming that your case is the first and you're counting only the "p"
children of q.
Then the XPath expression that will return the value of the "position" of a
"p" node among its siblings (assuming your current node is a grandchild of a
"p") is:
count(..\..\preceding-sibling::p) + 1
Hope this helped.
Cheers,
Dimitre Novatchev.
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list