This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: position() problem with // axis + parent numbering problem
- To: xsl-list at mulberrytech dot com
- Subject: Re: position() problem with // axis + parent numbering problem
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Tue, 18 Apr 2000 10:02:24 +0100 (BST)
- References: <38FBACEF.FCC49D9A@auckland.ac.nz>
- Reply-To: xsl-list at mulberrytech dot com
> I expected the following to produce mutually exclusive sets whose union
> includes all <text> nodes in the input document.
so would I. (and that's what I got when I tried it)
given
<a>
<text>a</text>
<b>
<text>b</text><text>c</text><text>d</text>
<b>
<text>e</text><text>f</text>
</b>
</b>
<text>g</text>
</a>
xt and xalan give
==================================
abe
==================================
cdfg
==================================
==================================
a
==================================
bcdefg
==================================
from the stylesheet below, in each case [1] and not(position()=1)
give mutually exclusive sets of nodes.
David
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
==================================
<xsl:apply-templates select="//text[1]" />
==================================
<xsl:apply-templates select="//text[not(position() = 1)]" />
==================================
==================================
<xsl:apply-templates select="(//text)[1]" />
==================================
<xsl:apply-templates select="(//text)[not(position() = 1)]" />
==================================
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list