Re: Paramters in templates

Subject: Re: Paramters in templates
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 23 Jul 1999 09:06:27 +0100 (BST)
> In the style sheet I'm working on I having to add the param support in
> hundreds of places to make sure it keeps getting passed down. This has
> doubled the size of my stylesheet and made it hard to read.


If carying the information down the tree is too much effort, it may be
simpler to leave it at the top, and just send back for it when you need
it.

ie rather than

<xsl:template match="A">
<xsl:apply-templates>
  <xsl:param name="label" expr="true"/>
</xsl:apply-templates>
<xsl:template>


<xsl:template match="B">
<xsl:apply-templates>
  <xsl:param name="label" expr="false"/>
</xsl:apply-templates>
<xsl:template>

and then all templates explicitly handling a parameter $label,
you can do

<xsl:template match="A|B">
<xsl:apply-templates/>
<xsl:template>


and then, when in the first version you actually used $label, rather
than just passing it on, now  go

  <xsl:if test="from-ancestors-or-self(A)">
   


David


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


Current Thread