predicates and variables in match attribute
Hi all!
Let's say we have this XML:
<frozenTreats>
<treat type="ice-cream">
<flavour>chocolate</flavour>
</treat>
<treat type="ice-cream">
<flavour>vanilla</flavour>
</treat>
<treat type="yogurt">
<flavour>chocolate</flavour>
</treat>
</frozenTreats>
My question is: can I use a variable in the match attribute of a template? Something like this:
<xsl:variable name="myPreferredTreat" select="'yogurt'"/>
<xsl:template match="treat[@type = $myPreferredTreat]">
<xsl:value-of select="concat(flavour, ' ', @type)"/>
</xsl:template>
thanks,
Rushman
__________________
Dijkstra's law on Programming and Inertia:
If you don't know what your program is supposed to do, don't try to write it.
|