xsl-list
[Top] [All Lists]

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

2006-06-06 06:18:32
On 6/6/06, Dimitre Novatchev <dnovatchev(_at_)gmail(_dot_)com> 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="{(_at_)id}"/>
 <xsl:next-match/>
</xsl>

cheers
andrew

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>