RE: position() problem with // axis + parent numbering problem

Subject: RE: position() problem with // axis + parent numbering problem
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 18 Apr 2000 09:49:30 +0100
> 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)]" />

You are right to expect this!
> 
> 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.

Can you tell us *exactly* what you wrote?

> 
> 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.  
>       <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>
> 
I think the <xsl:for-each> here is redundant. The <xsl:number> will give you
the number of the first ancestor that matches the count pattern.

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread