[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

Subject: Re: apply two different templates at the same time
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 31 Jan 2002 11:26:24 +0100 (MET)
xslt applying two templates
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.