Subject: RE: path-predicate question From: Kay Michael <Michael.Kay@xxxxxxx> Date: Thu, 10 Aug 2000 17:08:43 +0100 |
> > <xsl:when > test="preceding-sibling::*[starts-with(name(),'div')][position()=1]"> The [position()=1] predicate is redundant, since if there are any nodes in the node-set, there will be a first one, and in a boolean context you are only interested in whether the node-set is empty. > > The question is: Is this statement true only when the immediately > preceding sibling is a div or is it also true when there are any div > preceding siblings? position() in a predicate is the position in the node-set after filtering using all previous predicates. So the latter. If you want the former, reverse the order of the predicates. If the latter, then how do I select the first div > preceding sibling, skipping any non-div siblings? Does > > <xsl:value-of > select="preceding-sibling::*[starts-with(name(),'div')][positi > on()=1]"/> > > do the trick? Yes. > If so, then the [position()=1] part of the predicate > behaves differently when used with 'test' than with 'select', no? > No. Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: path-predicate question, David Carlisle | Thread | XML/XLink/XSL fundamentals, Raheja, Dhruv (TRAN |
Re: XML/XLink/XSL fundamentals, Mike Brown | Date | RE: Multiple Rows in a Table / Same, Pinto, Rebecca |
Month |