W3C home > Mailing lists > Public > xsl-editors@w3.org > January to March 2000

Wish list item: wild-card mode specification

From: G. Ken Holman <gkholman@cranesoftwrights.com>
Date: Fri, 17 Mar 2000 15:53:06 -0500
Message-Id: <4.2.0.58.20000317154103.00b2a920@pop1.attglobal.net>
To: XSL Editors <xsl-editors@w3.org>
Hi folks!

When considering new features for XSLT, I think I've come across a 
situation where I would like to write a template rule that matches all 
modes and doesn't change mode.

If the syntax chosen were to be a specified mode attribute with no 
attribute value, then it would be written as follows:

   <xsl:template match="caption" mode="">
     <xsl:param name="prefix"/>
     <i><xsl:value-of select="$prefix"/></i>
     <xsl:apply-templates mode=""/>
   </xsl:template>

The built-in rule that doesn't change mode could then be documented as:

<xsl:template match="*|/" mode="">
   <xsl:apply-templates mode=""/>
</xsl:template>

I am not wedded to any particular syntax, perhaps something like the 
following would use a key name (allowing for future key names??)

   <xsl:template match="caption" mode="xsl:same-mode">
     <xsl:param name="prefix"/>
     <i><xsl:value-of select="$prefix"/></i>
     <xsl:apply-templates mode="xsl:same-mode"/>
   </xsl:template>

My work around is just to have:

   <xsl:template match="caption" mode="toc">
     <xsl:param name="prefix"/>
     <i><xsl:value-of select="$prefix"/></i>
     <xsl:apply-templates mode="toc"/>
   </xsl:template>

   <xsl:template match="caption" mode="index">
     <xsl:param name="prefix"/>
     <i><xsl:value-of select="$prefix"/></i>
     <xsl:apply-templates mode="index"/>
   </xsl:template>

   <xsl:template match="caption">
     <xsl:param name="prefix"/>
     <i><xsl:value-of select="$prefix"/></i>
     <xsl:apply-templates/>
   </xsl:template>

... but that could get lengthy.

I hope this is worth consideration.

Thanks!

.................... Ken

--
G. Ken Holman                    mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/m/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Web site: XSL/XML/DSSSL/SGML services, training, libraries, products.
Practical Transformation Using XSLT and XPath      ISBN 1-894049-04-7
Next instructor-led training:    2000-05-02,2000-05-11/12,2000-05-15,
-                                    2000-06-12,2000-06-13,2001-01-27
Received on Friday, 17 March 2000 16:00:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:50 GMT