[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] [XSLT]Use value of parameter


Subject: Re: [xsl] [XSLT]Use value of parameter
From: "Felix Geller" <fgeller@xxxxxxxxx>
Date: Fri, 11 Apr 2008 11:46:22 +0200

Hi Izaskun!

On Fri, Apr 11, 2008 at 11:25 AM, IZASKUN GUTIERREZ GUTIERREZ
<igutierrez027@xxxxxxxxxxxxx> wrote:
> Hello everybody!
>
>  I want one templete. This template have one global parameter. In the
> template I need change value of the global parameter, but I dont know if
> this is possible and how to do it.

If I understand you correctly, you have one global xsl:variable and
want to assign a different value to it? If so, this is not possible in
XSLT as far as I know. But you could use a processor extension to do
this, if you don't believe in the benefits of avoiding side effects ;)

>  And other question:
>
>  I need pass a parameter from one template to other template and pass the
> result from the second template to de first (like a normal function).

When you invoke a template, you can use xsl:with-param to pass
parameters, the corresponding template should define the parameter in
its content. Perhaps the following helps:

<xsl:template match="/">
<xsl:call-template name="foo">
<xsl:with-param name="a">Hello Mary Lou</xsl:with-param>
</xsl:call-template>
</xsl:template>

<xsl:template name="foo">
<xsl:param name="a" />
<xsl:value-of select="$a" />
</xsl:template>

A template (the content of the xsl:template element) is the output, or
result as you put it. Not sure what you mean by "passing a result to a
template". In the above example, the content of the first (unnamed)
template, gets  replaced by the "result" of the foo template.

Hope this helps :)

Cheers,
Felix

>  Anybody can help me?
>
>  Thank you, Regards
>
>  Izaskun


Current Thread
Keywords