xsl template parameters

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
nleco
Forum Newbie
Posts: 9
Joined: Mon Oct 11, 2004 4:50 pm

xsl template parameters

Post by nleco »

I need help with xsl and parameters. i need help on figuring out how to pass in HTML as a parameter. here's what i'm doing, but it's not working:

---------------------
xsl code:
============
<xsl:call-template name="errorbox" >
<xsl:with-param name="message" >
<a href="#">text</a>
</xsl:with-param>
</xsl:call-template>

--i also tried passing in "<a href="#">text</a>" but that didnt work.

---------------------
xsl template:
============
<xsl:template name="errorbox">
<xsl:param name="message" select="''" />

<div class="errorbox">
<h2><xsl:text>Error: </xsl:text></h2>
<div class="boxcontent">
<xsl:value-of select="$message"/>
</div>
</div>
</xsl:template>
nleco
Forum Newbie
Posts: 9
Joined: Mon Oct 11, 2004 4:50 pm

Post by nleco »

I figured it out. I had to use "copy-of" instead of "value-of" in the template for the message:

<xsl:template name="errorbox">
<xsl:param name="message" select="''" />

<div class="errorbox">
<h2><xsl:text>Error: </xsl:text></h2>
<div class="boxcontent">
<xsl:copy-of select="$message"/>
</div>
</div>
</xsl:template>[/b]
Post Reply