|
[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








