[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How to add HTML code to variables

Subject: How to add HTML code to variables
From: "Harald Normann" <harald.normann@xxxxxx>
Date: Sun, 6 Feb 2000 12:26:49 +0100
html code variables
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">
      &lt;b&gt;Hello&lt;/b&gt;
    </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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.