Subject: [xsl] Re: Position of parent node From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Tue, 5 Jun 2001 06:32:53 -0700 (PDT) |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Position of parent node, Oliver Becker | Thread | Re: [xsl] How can I reindent an XML, Janning Vygen |
Re: [xsl] Position of parent node, Oliver Becker | Date | Re: [xsl] How can I reindent an XML, Janning Vygen |
Month |