[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Position of parent node

Subject: Re: Position of parent node
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Tue, 5 Jun 2001 06:32:53 -0700 (PDT)
position of parent node
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.