My problem is that I have a table with dynamic length and I need to span 3 Rows over 3 cells where the other rows have single cell length.
I get a generated XML file with values like
<item>
<val1>a</val1>
<val2>b</val2>
<val3_1>a1</val3_1>
<val3_2>b1</val3_2>
<val3_3>c1</val3_3>
<val4>c</val4>
</item>
and the table should look like
| val1: |-------val1---------| |-------val1---------|
| val2: |-------val2---------| |-------val2---------|
| val3: |val3_1|val3_2|val3_3| |val3_1|val3_2|val3_3|
| val4: |--------val4--------| |--------val4--------|
I have this source:
<fo:table width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell border-style="solid" border-width="1pt"
background-color="{$tabbgcolor}" width="50mm">
<fo:block>
val1:
</fo:block>
</fo:table-cell>
<xsl:for-each select="item">
<fo:table-cell border-style="solid"
number-columns-spanned="3" border-width="2pt" background-color="{$tabbgcolor}"
font-weight="bold" text-align="center">
<fo:block>
<xsl:value-of select="val1" />
</fo:block>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
<fo:table-row>
<fo:table-cell border-style="solid" border-width="1pt"
background-color="{$var_color_reserve}">
<fo:block text-indent="1em" wrap-option="wrap">
val2:
</fo:block>
</fo:table-cell>
<xsl:for-each select="item">
<fo:table-cell border-style="solid"
number-columns-spanned="3" border-width="2pt" background-color="{$tabbgcolor}"
text-align="center">
<fo:block>
<xsl:value-of select="val2" />
</fo:block>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
<fo:table-row>
<fo:table-cell border-style="solid" border-width="1pt"
background-color="{$var_color_reserve}">
<fo:block text-indent="1em" wrap-option="wrap">
Val3:
</fo:block>
</fo:table-cell>
<xsl:for-each select="item">
<fo:table-cell border-style="solid" border-width="2pt"
background-color="{$tabbgcolor}" text-align="center">
<fo:block wrap-option="wrap">
<xsl:value-of select="val3_1" />
</fo:block>
</fo:table-cell>
</xsl:for-each>
<xsl:for-each select="item">
<fo:table-cell border-style="solid" border-width="2pt"
background-color="{$tabbgcolor}" text-align="center">
<fo:block wrap-option="wrap">
<xsl:value-of select="val3_2" />
</fo:block>
</fo:table-cell>
</xsl:for-each>
<xsl:for-each select="instzahl">
<fo:table-cell border-style="solid" border-width="2pt"
background-color="{$tabbgcolor}" text-align="center">
<fo:block wrap-option="wrap">
<xsl:value-of select="val3_3" />
</fo:block>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
<fo:table-row>
<fo:table-cell border-style="solid" border-width="1pt"
background-color="{$var_color_reserve}">
<fo:block text-indent="1em" wrap-option="wrap">
val4:
</fo:block>
</fo:table-cell>
<xsl:for-each select="item">
<fo:table-cell border-style="solid"
number-columns-spanned="3" border-width="2pt" background-color="{$tabbgcolor}"
text-align="center">
<fo:block>
<xsl:value-of select="val4" />
</fo:block>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
</fo:table-body>
The problems are the following:
The values are parsed wrongly: I get all values val3_1 then all val3_2 and then all val3_3 instead of val3_1 val3_2 val3_3 and the next turn val3_1 val3_2 val3_3 and so on.
The spanning doesn't work. I get that is because I don't now how many cells I will have in the end because I can't foresee how many items will be in the xml file at the time it is generated.
Any ideas?