This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]