Subject: Preserving FO markup
From: "Robbert Brak" <robbert.brak@xxxxxxxxx>
Date: Fri, 18 Jan 2008 17:15:09 +0100
|
Hi,
I'm trying to do something like this, in an attempt to make creating
FO-documents more maintainable:
<xsl:template name="makeTableRow">
<xsl:param name="contentsOfFirstCell" />
<xsl:param name="contentsOfSecondCell" />
<fo:table-row>
<fo:table-cell>
<fo:block>
<xsl:value-of select="$contentsOfFirstCell"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<xsl:value-of select="$contentsOfSecondCell"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
<xsl:template name="makeComplexTableCell">
<fo:block>
<xsl:text>foo</xsl:text>
</fo:block>
<fo:block>
<xsl:text>bar</xsl:text>
</fo:block>
<!-- Some more complex stuff -->
</xsl:template>
<xsl:template name="myTemplate">
<xsl:variable name="simpleTableCell">
<xsl:text>baz</xsl:text>
</xsl:variable>
<xsl:variable name="complexTableCell">
<xsl:call-template name="makeComplexTableCell"></xsl:call-template>
</xsl:variable>
<xsl:call-template name="makeTableRow">
<xsl:with-param name="contentsOfFirstCell" select="$simpleTableCell" />
<xsl:with-param name="contentsOfSecondCell" select="$complexTableCell" />
</xsl:call-template>
</xsl:template>
The intended output, when I'm calling "myTemplate", would be something like:
<fo:table-row>
<fo:table-cell>
<fo:block>baz</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>
<fo:block>foo</fo:block>
<fo:block>bar</fo:block>
<!-- Some more complex stuff -->
</fo:block>
</fo:table-cell>
</fo:table-row>
Unfortunately, it doesn't seem to work that way, instead producing:
<fo:table-row>
<fo:table-cell>
<fo:block>baz</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>foobar</fo:block>
<!-- Some more complex stuff -->
</fo:block>
</fo:table-cell>
</fo:table-row>
Is there a way to do what I want?
Thanks a lot!
-R
|