Re: [xsl] How to use mode

Subject: Re: [xsl] How to use mode
From: Goetz Bock <bock@xxxxxxxxxxx>
Date: Tue, 26 Jun 2001 11:31:55 +0200
On Tue, Jun 26 '01 at 11:18, Griebel, Peer wrote:
> 1. Is a mode preserved? More precisely: If I call 
> 	<xsl:apply-templates mode="some-mode"/>
> And some called templated itself calls apply-templates, is it still in mode
> some-mode? 
No, but that is not a problem, if you do:
<xsl:apply-templates select="foo" mode="bar">
the template:
<xsl:template match="foo" />
will not be called, only
<xsl:template match="foo" mode="bar"/>
and there you can simply do:
<xsl:template match="foo" mode="bar">
  <!-- do something -->
  <xsl:apply-templates mode="bar"/>
</xsl:template>
to keep your mode.

> 2. How do I switch back to default mode? Templates specified without a mode
> are in default mode. But how can I call a template without a mode
> specification?
what about <xsl:apply-templates />

> 3. How can I combine modes?
You can't, but

<xsl:apply-templates mode="some-mode"/>
<xsl:apply-templates mode="some-other-mode"/>

should have the desired effect. But are you sure you realy need modes.

    Goetz.

Attachment: pgp00013.pgp
Description: PGP signature

Current Thread