Re: [xsl] xsl:with-param

Subject: Re: [xsl] xsl:with-param
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 15 Mar 2002 18:42:56 +0000
Hi Corneanu,

> Can you give me some help on calling a template with a tree-fragment
> as a parameter?

You're doing the calling just right - it's the *using* where you're
running into difficulties. In your template, you get the *value* of
the $firstCell and $secondCell parameters:

> <xsl:template name="addRow">
>   <xsl:param name="firstCell"/>
>   <xsl:param name="secondCell"/>
>   <fo:table-row font-size="12pt" line-height="14pt">
>     <fo:table-cell>
>       <fo:block><xsl:value-of select="$firstCell"/></fo:block>
>     </fo:table-cell>
>     <fo:table-cell>
>       <fo:block><xsl:value-of select="$secondCell"/></fo:block>
>     </fo:table-cell>
>   <fo:table-row>
> </xsl:template>

What you need to do is *copy* the values of those parameters with the
xsl:copy-of instruction:

<xsl:template name="addRow">
  <xsl:param name="firstCell"/>
  <xsl:param name="secondCell"/>
  <fo:table-row font-size="12pt" line-height="14pt">
    <fo:table-cell>
      <fo:block><xsl:copy-of select="$firstCell"/></fo:block>
    </fo:table-cell>
    <fo:table-cell>
      <fo:block><xsl:copy-of select="$secondCell"/></fo:block>
    </fo:table-cell>
  <fo:table-row>
</xsl:template>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread