This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xsl:variable containing xsl:element
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] xsl:variable containing xsl:element
- From: Oliver Becker <obecker at informatik dot hu-berlin dot de>
- Date: Fri, 26 Jan 2001 15:56:49 +0100 (MET)
- Reply-To: xsl-list at lists dot mulberrytech dot com
Rainer,
> 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(...)
Cheers,
Oliver
/-------------------------------------------------------------------\
| ob|do Dipl.Inf. Oliver Becker |
| --+-- E-Mail: obecker@informatik.hu-berlin.de |
| op|qo WWW: http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list