[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: apply two different templates at the same time
Hi Andrew, > I have a load of data and a load of templates, and it all gets displayed > nicely. If any of the elements in the data contain an attribute 'mark="1"' > then the data should be highlighted by changing its background colour. The > mark attribute can apply to any element in the data. > > Currently, I use two templates for each element - one matching just the > element and one matching the element with the 'mark' attribute... Create a new stylesheet with the following content: <xsl:import href="your-original-stylesheet.xsl" /> <xsl:template match="*[@mark=1]"> <highlight> <xsl:apply-imports /> </highlight> </xsl:template> Probably <highlight> is actually something like <div class="marked"> ... Use this new stylesheet and it should do what you want. In "your-original-stylesheet.xsl" you don't have to care about the mark attributes. I currently don't know if there's a simpler solution with XSLT 2.0 Cheers, Oliver /-------------------------------------------------------------------\ | ob|do Dipl.Inf. Oliver Becker | | --+-- E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx | | op|qo WWW: http://www.informatik.hu-berlin.de/~obecker | \-------------------------------------------------------------------/ 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
|