This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
How to add HTML code to variables
- To: <xsl-list at mulberrytech dot com>
- Subject: How to add HTML code to variables
- From: "Harald Normann" <harald dot normann at wts dot se>
- Date: Sun, 6 Feb 2000 12:26:49 +0100
- Reply-To: xsl-list at mulberrytech dot com
Hi,
I'm not succeding in passing HTML to a template. I'm trying to create a
template for creating rows in a table. The template is called using a
parameter named "label". The template looks like:
<xsl:template name="TableRow">
<tr>
<td><xsl:value-of select="$label"/></td>
</tr>
</xsl:template>
When calling the template I use the following syntax:
<xsl:template match="FreeText">
<xsl:call-template name="TableRow">
<xsl:with-param name="label">Hello</xsl:with-param>
</xsl:call-template>
</xsl:template>
This workes fine, however I'm not succeding in adding HTML code to the
variable.
<xsl:template match="FreeText">
<xsl:call-template name="TableRow">
<xsl:with-param name="label"><b>Hello</b></xsl:with-param>
</xsl:call-template>
</xsl:template>
The result is "Hello" without bold! Where do the <b></b> directives goes? I
have also tryed to declare a separate variable:
<xsl:template match="FreeText">
<xsl:variable name="somevalue">
<b>Hello</b>
</xsl:variable>
<xsl:call-template name="TableRow">
<xsl:with-param name="label"><xsl:value-of
select="$somevalue"/></xsl:with-param>
</xsl:call-template>
</xsl:template>
This also just produce "Hello" without bold. Using XML charachter code:
<xsl:template match="FreeText">
<xsl:variable name="somevalue">
<b>Hello</b>
</xsl:variable>
<xsl:call-template name="TableRow">
<xsl:with-param name="label"><xsl:value-of
select="$somevalue"/></xsl:with-param>
</xsl:call-template>
</xsl:template>
Now the screen displays "<b>Hello</b>". The <b></b> is not interpreted as
HTML code. How is this really solved?
TIA
/Harald
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list