Re: [xsl] Using a template's (HTML) output as with-param?

Subject: Re: [xsl] Using a template's (HTML) output as with-param?
From: "Nick Fitzsimons" <nick@xxxxxxxxxxxxxx>
Date: Fri, 9 Dec 2005 08:31:19 -0000 (GMT)
> URL template:
>
> 	<xsl:template name="HrefTest">
> 		<xsl:text><h3>test</h3></xsl:text>
> 	</xsl:template>
>
> Caption template:
> 	<xsl:template name="TableHeader">
> 		<xsl:param name="caption1" />
> 		<xsl:param name="caption2" />
> 		<tr><td><h1><xsl:value-of select="$caption1"
> /></h1></td></tr>
> 		<tr><td><xsl:value-of select="$caption2" /></td></tr>
> 	</xsl:template>
>
> Usage:
> 	<table>
> 		<xsl:call-template name="TableHeader">
> 			<xsl:with-param name="caption1">First
> Caption</xsl:with-param>
> 			<xsl:with-param name="caption2">
> 				<xsl:call-template name="HrefTest" />
> 			</xsl:with-param>
> 		</xsl:call-template>
> 	</table>
>
> Expected result:
> <table><tr><td><h1>First
> Caption</h1></td></tr><tr><td><h3>test</h3></td></tr></table>
>
> Actual result:
> <table><tr><td><h1>First
> Caption</h1></td></tr><tr><td>test</td></tr></table>
>


Change

<xsl:value-of select="$caption2"/>

to

<xsl:copy-of select="$caption2"/>

and it should be fine.


HTH,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/

Current Thread