Re: match on attribute anywhere
Here is another one, really the same process but substituting for-each in place of the extra mode. In your existing templates, replace all occurences of <xsl:apply-templates /> by <xsl:call-template name="do-children" /> then: <xsl:template name="do-children"> <xsl:for-each select="node()"> <xsl:choose> <xsl:when test="@mark='1'"> <span style="color:#FF0000"> <xsl:apply-templates select="." /> </span> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="." /> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template> I'm not sure I like this one as much: if you have anything except a plain xsl:apply-templates (for example you want to select just some of the children) you end up having to write another template like the one above, because you cannot pass the select expression in as a parameter (without using an extension function like 'evaluate'). Let me know when you find a solution you like, then I will shut up ;-) Regards, Trevor Nash -- Traditional training & distance learning, Consultancy by email Melvaig Software Engineering Limited voice: +44 (0) 1445 771 271 email: tcn@xxxxxxxxxxxxx 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