Peter,
Thanks.
----- Original Message -----
From: "Peter Davis" <[EMAIL PROTECTED]>
To: "Hugo Ferreira" <[EMAIL PROTECTED]>
Sent: Tuesday, March 12, 2002 1:35 PM
Subject: Re: Newbie: quick question OT
On Tuesday 12 March 2002 04:09, Hugo Ferreira wrote:
> The ideia is not to use the variable as an attribute but as an elements'
> text, for example
> I wanted something like this
> <A>"{$sa}"</A>
> where $a="xpto"
> to result in <A>xpto</A>
<A>"<xsl:value-of select="$sa"/>"</A>
If you are not in an element's attribute, then you have to use
<xsl:value-of/> instead of {...}.
But the template you wrote will work too.
>
> I finally solved this by using a template that uses a parameter, for
> example:
>
> <xsl:template name="text-block">
> <xsl:param name="field"></xsl:param>
> <xsl:if test="not(string($field))">NULL</xsl:if>
> <xsl:if test="string($field)"><xsl:value-of select="$field"/></xsl:if>
> </xsl:template>
>
> called in the following manner
>
> <xsl:call-template name="text-block"><xsl:with-param
> name="field">"<xsl:value-of
> select="segment"/>")</xsl:with-param></xsl:call-template>
>
> which results in either NULL or "value of the node(segment)"
--
Peter Davis
You will gain money by a speculation or lottery.