[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] XSLT 2.0: Reasons for mode="#all" ?


Subject: Re: [xsl] XSLT 2.0: Reasons for mode="#all" ?
From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 6 Jun 2006 14:18:16 +0100

On 6/6/06, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
I was wondering if somebody could provide an example where using

mode="#all"

(http://www.w3.org/TR/xslt20/#modes)

is necessary and useful.


It seems to me that using this feature can be dangerous and harmful -- when should we recommend it?

It very useful when you apply-templates in different modes, but then need an overriding template to apply to all modes.

For example:

<heading>Some Title<heading>

<xsl:apply-templates select="heading" mode="bold"/>
<xsl:apply-templates select="heading" mode="italic"/>

etc, then you need to add a template to output an anchor for each
heading, you can just use:

<xsl:template match="heading" mode="#all">
 <a id="{@id}"/>
 <xsl:next-match/>
</xsl>

cheers
andrew


Current Thread