This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Variable Scope and xsl:if
- To: xsl-list at mulberrytech dot com
- Subject: Re: Variable Scope and xsl:if
- From: Omar López Ruiz <omar at informix dot com>
- Date: Wed, 19 Apr 2000 13:38:37 +0200
- Organization: Informix Software Ibérica S.A.
- References: <OF67D9FE7F.67C9226A-ON852568C5.0057A0CC@Lotus.com>
- Reply-To: xsl-list at mulberrytech dot com
David,
And what happens if the value that I assign to the variable is not
true or false, and <xsl:call> calls a template that return text (nodes),
and I don't want at all this text. I've tried this:
<xsl:template matches="whatever">
<xsl:variable name="foo">
<xsl:choose>
<xsl:when test="$foo">
<xsl:value-of select="a value"/>
<some xsl tags and xsl:call templates (with returning text)> <!--
but I don't want to assign this text!!! -->
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="a different value"/>
<some other xsl tags>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</xsl:template>
I've found a solution, two <xsl:choose>, one inside the
<xsl:variable> element, with only the <xsl:value-of>, and the other one,
after the first <xsl:choose> with the rest of the xsl elements and
<xsl:call> elements.
Please, there's a different solution?
Thanks,
Omar
David_Marston@lotus.com wrote:
> It could be changed to:
> <xsl:template matches="whatever">
> <xsl:variable name="foo" select="something"/>
> <xsl:choose>
> <xsl:when test="$foo"> <!-- Assumed to be
> faster than re-evaluating the "something" expression -->
> <some xsl tags and xsl:call templates>
> </xsl:when>
> <xsl:otherwise>
> <some other xsl tags>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
begin:vcard
n:López Ruiz;Omar
tel;fax:(34) 93 363 79 98
tel;work:(34) 93 363 79 86
x-mozilla-html:FALSE
url:www.informix.com/es
org:Informix Software Ibérica;Web Solutions Division
adr:;;Av. Diagonal, 615 8-F;Barcelona;;08028;Spain
version:2.1
email;internet:omar@informix.com
title:Pre-sales Engineer
x-mozilla-cpt:;-28176
fn:Omar López Ruiz
end:vcard