|
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:
<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() < 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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: JavaScript problems in my XSL f, Perry Molendijk | Thread | Re: Following-sibling axis - origin, David Carlisle |
| Re: preceding-sibling context, ken . dickerson | Date | apply-templates iside for-each?, Norman Walsh |
| Month |