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

Fwd: multiple/default template modes

Subject: Fwd: multiple/default template modes
From: Jonathan Kart <jkart@xxxxxxxxxxxx>
Date: Sun, 6 Jun 2004 23:21:03 -0700
xsl template modes
Hi All,

I'm not sure if this is a FAQ question, but i've looked and I can't find exactly what I'm trying to do.

I have several xsl templates which may all apply to a certain xml node. our front-end team uses apply-templates calls to pull out info from the xml file they want. For example,

<h1> <xsl:apply-templates select="title" mode="normal"/></h1>

if they want an editable version of the title (<input type=text ..../>)
they use:

<h1> <xsl:apply-templates select="title" mode="editable"/></h1>

Point is, I would like to be able to provide a default mode for different contexts. Therefore, a call like
<h1> <xsl:apply-templates select="title" /></h1> <!-- no mode -->
would use a default template. Currently, this is implemented by duplicating the template with no mode. ie-
<xsl:template match="title" mode="editable">... xsl here ... </xsl:template>
<xsl:template match="title" mode="normal">... xsl here ... </xsl:template>
<xsl:template match="title">... xsl here ... </xsl:template> <!-- this is a duplicate of either editable or normal depending on context -->


Obviously, this increase the size of our xsl files and is just plain ugly. Is it possible to have a xsl:template match more than 1 mode?
The pseudocode of what we want is:
<xsl:template match="title" mode="editable | normal">... xsl here ... </xsl:template>
or more like
<xsl:template match="title" mode="normal | -no mode specified-">... xsl here ... </xsl:template>


I have a feeling this isn't possible from reading the faq's but i thought i'd throw it out.

Thanks for any help. In fact, thanks for all the help this list has provided me over the past several months. As a newcomer to xsl, it has been invaluable to my growth to be in touch with so many intelligent, helpful xsl developers.

Thanks again,
Jonathan



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.