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

Re: Moded Templates

Subject: Re: Moded Templates
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 6 Jan 2003 20:16:14 +0000
mode attribute in xslt
Hi Will,

> After looking at the spec ( http://www.w3.org/TR/xslt#modes ) and
> searching the "biglist", I could not find the answer to my question.
> Besides a "qualified name" what other values can be used when
> specifying a mode, is there a way to define a template using an 'or'
> (|) or a wildcard (*),

No. The only legal values for the mode attribute in XSLT 1.0 is a
qualified name. One way around that is to have default templates for
the modes that you want default behaviour for. Something like:

<xsl:template match="*" mode="A">
  <xsl:apply-templates select="." mode="B" />
</xsl:template>
<xsl:template match="*" mode="B">
  <xsl:apply-templates select="." mode="C" />
</xsl:template>
<xsl:template match="A" mode="C">
  ...
</xsl:template>
<xsl:template match="B" mode="C">
  ...
</xsl:template>

This way whenever templates are applied to A or B elements in mode A
or B, the template for mode C will be used.

In XSLT 2.0, the mode attribute on xsl:template can take a list of
qualified names, specified by spaces. So in XSLT 2.0 you will be able
to do:

<xsl:template match="A" mode="A B C">
  ...
</xsl:template>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.