Hi,
First of all, you forget to wrap the snippet
Code:
<fo:table-body table-layout="fixed">
<xsl:apply-templates select="/table/record">
<xsl:with-param name="productType" select="asset_name"/>
</xsl:apply-templates>
</fo:table-body>
by
<xsl:template match="/"> and </xsl:template>.
I think the simplest solutuion is the following:
Since you build the table rows from different templates, it's probably impossible (or is possible with complicated tricks, I don't know) to put alternating-color rows. You can gather the rows into the variable, and then put the alternating-colors trivially:
Here is the necessary code-snippet which you have to change:
original(with the corrections I've just noted above):
Code:
<xsl:template match="/">
<fo:table-body table-layout="fixed">
<xsl:apply-templates select="/table/record">
<xsl:with-param name="productType" select="asset_name"/>
</xsl:apply-templates>
</fo:table-body>
</xsl:template>
change to
Code:
<xsl:template match="/">
<xsl:variable name="rows">
<xsl:apply-templates select="/table/record">
<xsl:with-param name="productType" select="asset_name"/>
</xsl:apply-templates>
</xsl:variable>
<fo:table-body table-layout="fixed">
<xsl:for-each select="exsl:node-set($rows)/*">
<xsl:copy>
<xsl:for-each select="@*">
<xsl:copy-of select="."/>
</xsl:for-each>
<xsl:attribute name="fo:some-attribute-for-background">
<xsl:choose>
<xsl:when test="position() mod 2 = 1">
<xsl:text>#aaaaaa</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>#ffffff</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:copy-of select="*"/>
</xsl:copy>
</xsl:for-each>
</fo:table-body>
</xsl:template>
And also add this namespace declaration in the xsl:stylesheet element:
Code:
xmlns:exsl="http://exslt.org/common"
Note: I'm not familiar well with elements in the namespace "fo", so I've put fictive attribute "fo:some-attribute-for-background" for element "fo:table-row".
Regards,
Armen