Re: [xsl] Variables and the mode attribute in apply-templates

Subject: Re: [xsl] Variables and the mode attribute in apply-templates
From: Ragulf Pickaxe <ragulf.pickaxe@xxxxxxxxx>
Date: Thu, 3 Nov 2005 15:46:53 +0100
Hi Ben,

I do not think it is possible to do what you are trying.
I usualy only do tests on attributes or node values in the context,
but perhaps something like this will work for you?

<xsl:variable name="Layout" select="/content/layout/node()"/>
<xsl:template match="SomeTemplate">
  <xsl:apply-templates select="xxx"/>
</xsl:template>

<xsl:template match="xxx[$Layout='OneLayout']">
  <!-- Do something with this one -->
</xsl:template>

<xsl:template match="xxx[$Layout='AnotherLayout']">
  <!-- Do something with this other one -->
</xsl:template>

Regards,
Ragulf Pickaxe :-)

On 11/3/05, ben senior <ben@xxxxxxxxxxxxx> wrote:
> I wish to decide between calling one of a set of templates depending on
> a fragment of xml (/content/layout/node()).
>
> Rather than having a mass of xsl:when/choose statements, I thought I
> would add :
>
> <xsl:apply-templates select="xxx" mode="{/content/layout/node()}"/>

Current Thread