Hi
I have the following problem: Given an xml like the following:
<test>
<items>
<item>
<index>1</index>
<property>x</property>
</item>
<item>
<index>2</index>
<property>y</property>
</item>
<item>
<index>3</index>
<property>x</property>
</item>
</items>
</test>
and a stylesheet like:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="test">
<myTest>
<xsl:variable name="xItems">
<xsl:copy-of select="items"/>
</xsl:variable>
<xsl:apply-templates
select="items[item/property='y']"/><!-- wrong try! -->
</myTest>
</xsl:template>
<xsl:template match="items">
<xsl:for-each select="item">
<myItem>
<xsl:value-of select="index"/>
</myItem>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I would like to pass only the items with property='x' to the items
matching template. The first try as written above of course doesn't
work, if there is an x item then the whole tree is passed, if there is
none, nothing is passed. I do further processing in the items
template, so I don't want to change it to match="item" or to apply the
filter in the items template.
Any help is much appreciated!
thanks, kind regards
Stefan
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--