Re: Paramters in templates

Subject: Re: Paramters in templates
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 22 Jul 1999 18:13:47 +0100 (BST)
You normally need to explictly pass it on, something like:

<xsl:apply-templates select=". . . ">
   <xsl:param name="label" expr="$label"/>
</xsl:apply-templates>


> For example if I had:
><DIV>
>  <P>
>    <FIELD>
>What happens if I later add a match for <P>?

If the apply-templates in your rule for <DIV> selects children (the
default behaviour) then the parameter will only be seen by templates
fired by that nodes in that list, so in this case the rule for P
had better pick up the label parameter and pass it on as above, elese
the rule for FIELD won't see it.

But if your template for DIV calls apply-templates with // or explitly
./P/FIELD or anything else such thatthe FIELD element is in the node
list returned by the select expression, then the FIELD template will see
the `original' setting of the parameter from your apply-templates call
in DIV, and won't need to be called via a template for P.

David


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


Current Thread