Subject: Re: [xsl] Second of two consecutive call-template instructions appears to affect the first? From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 15 Mar 2006 11:48:58 -0500 |
I hope your class went well. You may remember that you were going to quote me as saying "we're just not used to having things done for us are we?"
Regarding the problem in hand, I just don't get it. Why should this work fine:
<xsl:call-template name="does-image-flickr" /> . . <xsl:template name="does-image-flickr"> <xsl:choose><!-- photo is a flickr link --> <xsl:when test="/page/images/image[@name=$name]/flickr"> ^^^^ [variable 'name' is OK]
...and this cause an error:
<xsl:call-template name="does-image-flickr" />
<xsl:call-template name="write-caption">
<xsl:with-param name="cpos"><xsl:value-of select="$cpos" /></xsl:with-param>
<xsl:with-param name="caption"><xsl:value-of select="$caption" /></xsl:with-param>
</xsl:call-template>
.
.
<xsl:template name="does-image-flickr">
<xsl:choose><!-- photo is a flickr link -->
<xsl:when test="/page/images/image[@name=$name]/flickr">
^^^^
[variable 'name' causes an error]
...where the only difference is the call to the 'write-caption' template that comes _after_ the call to the 'does-image-flickr' template.
<xsl:template name="does-image-flickr"> <xsl:param name="cpos" select="''"/> <!-- this declaration provides the parameter with an empty string as its default value --> <xsl:choose><!-- photo is a flickr link --> <xsl:when test="/page/images/image[@name=$name]/flickr">
The fact that the call to 'does-image-flickr' works in the first instance proves to me what I have been lead to believe, namely that call-template differs from apply-templates in that the local scope is unchanged as well as the current node list. My experience whilst writing this template has also served to confirm this.
I have several exapmples where templates called using call-template make use of params defined in the callee without explicitly passing the params using with-params.
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Second of two consecutive, Michael Kay | Thread | Re: [xsl] Second of two consecutive, Sebastian Tennant |
Re: [xsl] Second of two consecutive, Sebastian Tennant | Date | Re: [xsl] How do I convert the use , Shirley Gasch |
Month |