[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|