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: David Carlisle <davidc at nag dot co dot uk>
- Date: Mon, 29 Jan 2001 09:41:16 GMT
- References: <31767643794BD411977600D0B747AC76016A7296@zwicky.gva.hp.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
The string contains HTML code
If you think of HTML (or XML) markup being part of a string you'll
always get confused by XSLT. XSLT (unlike, say perl) does not work on
the string representation of an XML document, but on a tree
representation.
// This doesn't work - displays the number BUT not bold
<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)"/>
as mentioned before, both string() and value-of() are doing the same thing
here, giving the string value of the expreesion, which will throw away
any element nodes.
The reason for the variable is that I want to pass it to another template
using
<xsl:call-template name="getConfirmationPage">
<xsl:with-param name="Header" select="Title/Text"/>
<xsl:with-param name="Title" select="$wholestring"/>
</xsl:call-template>
That in itself isn't a reason, you could just use
<xsl:with-param name="Title"
>This is my account <b>123.456</b> now closed</xsl:with-param>
you don't need a variable if it's only used there.
> The <xsl:copy-of select="$wholestring"/> throws the following error
It shouldn't. Are you sure you have that line somewhere in the scope of
the wholestring variable (that is, in teh same template)
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list