This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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




> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]