Following-sibling axis - original tree or current result-set?

Subject: Following-sibling axis - original tree or current result-set?
From: Jeff Saylor <JSaylor@xxxxxxxxxxxxxxxxx>
Date: Fri, 3 Nov 2000 15:55:03 -0400 (EST)
Given the following XML:

		<item name="smallItem1" />
		<item name="smallItem2" />
		<item name="smallItem3" />
		<item name="smallItem4" />
		<item name="bigItem1" />
		<item name="bigItem2" />
		<item name="bigItem3" />
		<item name="bigItem4" />

And given the following XSL which is attempting to output only the "small
items" elements (elements with "small" in the name) in rows of 3 columns

  <xsl:template match="/">
  <table width='100%' border='1'>

    <xsl:for-each select="//items/item[ (position() mod 3= 1) and
contains(@name, 'small') ]">
        <xsl:for-each select=". | following-sibling::image[position() &lt; 3
            <xsl:value-of select="@name" />


why do I end up with something like:

  smallItem1  smallItem2  smallItem3
  smallItem4  bigItem1    bigItem2

It seems that the following-sibling in the second for-each actually refers
to the axis from the original tree, not the axis of the result set from the
first for-each.  Is this right?  And, if so, how do I get the
following-sibling to only refer to the result set of the second for-each?

Appreciation in advance for any and all insight - cheers,

Jeffrey J. Saylor

 XSL-List info and archive:

Current Thread