Re: conditional processing in templates

Subject: Re: conditional processing in templates
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 22 Jul 1999 09:41:53 +0100 (BST)
> But this doesn't work because $label would be a side effect.

No it didn't work because you didn't pass the variable down to your
template.

The action of this template

  <xsl:template mode="display" match="*[@type='date']">

depends on the value of the variable label, so you need to declare that
as a parameter to the template, so the template should begin

<xsl:param-variable name="label" exp="0"/>
<!-- default value optional, this is april syntax not July -->

then don't do this

 <xsl:variable name="label">1</xsl:variable>

do this

<xsl:apply-templates mode="display" select="First">
  <xsl:param name="label" expr="1"/>
</xsl:apply-templates>

actually rather than use 0 and 1 and have to test equality you could use
true and false.

David


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread