Subject: Re: [xsl] count following-sibling node() From: "Vasu Chakkera" <vasucv@xxxxxxxxx> Date: Mon, 17 Nov 2008 11:48:33 +0000 |
*My earlier post got moderated by Hotmail as it did not consider XML as legitimate text* I am sure people made some sence of my mail but this is what I meant.. Calling node() is not the same as calling the Element itself Node in Xpath means: element, attribute, text, namespace, processing-instruction, comment, and document (root) nodes. This is the tricky bit you should be careful about when you are using the position() function or calculating the following sibling etc.. Your logic will *Fail* if there are other elements , or text nodes etc.. the easiest way to explain your problem is to introduce another element after your sixth EVENT , call it *NEW-EVENT* <xsl:value-of select="count(following-sibling::EVENT)"/> will call ONLY EVENT nodes <xsl:value-of select="count(following-sibling::node())"/> WILL CALL even the NEW-EVENT nodes This is easy identification of problem. It gets tricky when there are invisible nodes like the text nodes. <xsl:value-of select="count(following-sibling::EVENT)"/> will call ONLY EVENT nodes When <xsl:value-of select="count(following-sibling::node())"/> WILL CALL *ALL* the nodes including the invisible text nodes. Its really not *invisible* text nodes for a pair of eyes seeing XML for a long time. But it could be confusing!! I think this is where you got confused. HTH Vasu Chakkera Numerical Algorithms Group. Oxford www.vasucv.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] fault tolerant saxon:pars, Colin Adams | Thread | RE: [xsl] disable out escaping for , Vasu Chakkera |
Re: [xsl] fault tolerant saxon:pars, David Carlisle | Date | Re: [xsl] fault tolerant saxon:pars, Andrew Welch |
Month |