Subject: position() problem with // axis + parent numbering problem From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx> Date: Tue, 18 Apr 2000 12:31:43 +1200 |
Hi - two questions. One --- The position() function isn't returning what I was expecting when combined with the // axis, and I haven't been able to find what I'm after in the spec - can someone point out why this isn't working? I expected the following to produce mutually exclusive sets whose union includes all <text> nodes in the input document. <xsl:apply-templates select="//text[1]" /> <xsl:apply-templates select="//text[not(position() = 1)]" /> It appears this is not the case - I've tested this in Saxon and Xalan, so I'm confident the implementors have it right - I just don't know why. "[position() = 1]" returns all nodes that are the first children of their parents, while [1] returns the first node in the context list. I thought that [1] was the abbreviation for the other. Can someone tell me where it says otherwise? How should I put the predicate in the second expression to be the opoosite of that in the first - ie, all nodes other than the first in the context list Two --- I was trying to get the number of the parent node of the current node taken across the entire document, and I can't see an easy way to do it. The parent may not be the real parent, but may be several steps up the tree, although I do know the element is of type <grouping_element>. The following seems to work, but is there any way to condense this into a single <xsl:number> element? <xsl:variable name="parent_number"> <xsl:for-each select="ancestor::grouping_element[1]"> <xsl:number count="grouping_element" level="any" /> </xsl:for-each> </xsl:variable> Thanks in advance. -- Warren Hedley Department of Engineering Science Auckland University New Zealand XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: inconsistent results from style, Bob White | Thread | Re: position() problem with // axis, David Carlisle |
Re: inconsistent results from style, Steve Muench | Date | Re: inconsistent results from style, Bob White |
Month |