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

comment on 'mode' and also Re: Processing modes

Subject: comment on 'mode' and also Re: Processing modes
From: "Alistair MacDonald" <AlistairMacDonald@xxxxxxxxxxxxx>
Date: Thu, 15 Apr 1999 10:55:35 +0100
no mode

>>> Lars Marius Garshol <larsga@xxxxxxxxxx> 04/15 8:19 am >>>
> My understanding of processing modes is that 
>    <xsl:apply-templates modes="by-number"/>
> should only apply template rules that have the by-number mode and
> ignore all template rules that have no mode.

That should be 'mode', not 'modes'. The match sequence will be a template that HAS the required 'mode' and, if that fails a template with NO mode. *HOWEVER* 'mode's are NOT sticky, so given this:

-----
<doc>
<foo>
<bar>wibble</bar>
</foo>
</doc>
-----

and

-----
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"
        result-ns="">

<xsl:template match="doc">
<xsl:apply-templates mode="test" />
</xsl:template>

<xsl:template match="bar" mode="test">
Found bar in test, value: <xsl:value-of select="text()" />
</xsl:template>

<xsl:template match="bar">
Found bar **NO MODE**, value: <xsl:value-of select="text()" />
</xsl:template>

</xsl:stylesheet>
-----

The result is:

-----
Found bar **NO MODE**, value: Wibble
-----

Why ? Because, as I said, modes aren't sticky and have to be *EXPLICITLY* passed on. However, <foo> was matched by the IMPLICIT rule, which didn't explicitly pass on the mode. This, compined with the fact that there is no way of find the *XSL* parameters to the triggering <xsl:apply-templates ... /> means that 'mode' is *almost* useless. (It *DOES* have uses, but trying to use it effectively means implementing lots of "do-nothing" templates which just call apply-templates with the same mode as they had!)

There is no reason why 'mode' should not be sticky, since it could easily be cancelled ('mode=""') and, if no mode is matched it defaults to the empty mode.

Alistair



 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-2011 All Rights Reserved.