|
Subject: Re: [xsl] apply two different templates at the same time From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 31 Jan 2002 11:26:24 +0100 (MET) |
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] An issue with XPath 2.0 s, Evan Lenz | Thread | RE: [xsl] apply two different templ, ben |
| Re: [xsl] How to get a value from o, Joerg Heinicke | Date | RE: [xsl] check if a* not equal to , Michael Kay |
| Month |