[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Using mode to override templates

Subject: Using mode to override templates
From: "Andrew Welch" <awelch@xxxxxxxxxxxxxxx>
Date: Mon, 1 Jul 2002 15:18:01 +0100
 Using mode to override templates
..apologies if this has been discussed before

I want to merge my print and my 'screen' stylesheets into one to aid
maintainability.  Ideally I want to do this:

<xsl:when test="$print = 'yes'">
  <xsl:apply-templates mode="print"/>
</xsl:when>
<xsl:otherwise>
  <xsl:apply-templates/>
</xsl:otherwise>

With all templates firing as usual, except those with the mode overiding
their non-mode counterparts.

(essentially only a few templates have the mode attribute, such as
tables (remove scrolling)) and inline graphics.

Obviously, apply-templates with a mode will only use templates with a
matching mode (and not fire all the templates that are common to both
and therefore would not have a mode) - how do I overcome this?

I suppose on each template I could use a big if-else (or choose-when ;)
and separate the code that way, but I would prefer to use the neater
mode approach if thats possible.

cheers
andrew 




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.350 / Virus Database: 196 - Release Date: 17/04/2002
 

 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.