xsl-list
[Top] [All Lists]

[xsl] Preserving FO markup

2008-01-18 09:15:43
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>