This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to use mode



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.

PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]