Re: [xsl] xsl:variable containing xsl:element

Subject: Re: [xsl] xsl:variable containing xsl:element
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 26 Jan 2001 15:56:49 +0100 (MET)

> I have the following problem when assigning a string to a variable. The
> string contains HTML code in between.
> <xsl:template match="Language/*">
>   // This works fine - displaying the number bold
>   This is my account <xsl:element name="b">123.456</xsl:element> now closed
>   // This doesn't work
>   <xsl:variable name="wholestring">This is my account <xsl:element
> name="b">123.456</xsl:element> now closed</xsl:variable>
>   <xsl:value-of select="string($wholestring)"/>
> </xsl:template>

The variable doesn't contain a string, it contains something the XSLT Spec
calls `result tree fragment', i.e. the variable contains text and elements
(and other markup if you include it in the variable definition).

In this case you have to use <xsl:copy-of select="$wholestring" />
-> no xsl:value-of ...
-> no string(...)


|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW: |

 XSL-List info and archive:

Current Thread