[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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)
following sibling axis
Given the following XML:

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

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
each:

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

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

  </table>
  </xsl:template>

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
jsaylor@xxxxxxxxxxx





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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.