This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Problem passing value of variable using xsl:call-t
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Problem passing value of variable using xsl:call-t
- From: Steven dot C dot Kienle at am dot pnu dot com
- Date: Thu, 26 Jul 2001 07:34:38 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
I think you are confused. The xsl:with-param/xsl:param is used to
pass values TO the called template, not to return them. I'm not sure
why you want to return a value, but if you wish to capture the result
of the called template for later use you can use the following:
<xsl:variable name="call-result">
<xsl:call-template name="Take-XYZ" />
</xsl:variable>
<xsl:template name="Take-XYZ">
<xsl:value-of select="A/K/L/M"/>
</xsl:template>
The result tree fragment produced by Take-XYZ will then be put into
the call-result variable. In this case the value of the selected
nodes.
Of course, this may not be actually what you are looking for, and in
this case is a wasted call since the result is a "constant" value.
Also, you need to understand that you may not be able to use the
call-result variable everywhere you may wish to, such as in
<xsl:apply-templates select="$call-result" />
I think I got this information right, I'm sure if I didn't one of the
real experts will jump in.
______________________________ Reply Separator _________________________________
Subject: [xsl] Problem passing value of variable using xsl:call-templ
Author: xsl-list@lists.mulberrytech.com at Internet-America
Date: 25-07-2001 4:16 PM
Hi everybody ! I have a problem passing value of parametr using
xsl:call-template and xsl:with-param.
Thanks a lot in advance. Alex.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates select="A/B/C/D">
</xsl:apply-templates>
</xsl:template>
<xsl:template match="A/B/C/D">
<xsl:text>111</xsl:text>
<xsl:value-of select="E"/>
......................................
<xsl:call-template name="Take-XYZ">
<xsl:with-param name="XYZ" select=" What should I specifiy here to get
result from template Take-XYZ ??????? " />
</xsl:call-template>
......................................
</xsl:template>
<xsl:template name="Take-XYZ">
<xsl:param name="XYZ">
<xsl:value-of select="A/K/L/M"/>
</xsl:param>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list