This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to add HTML code to 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]