I m generating a table in a pdf document using xml-fo.
The number of columns is dynamic. Columns are only displayed when tests are passing.
In tests I m using variables like $var1, $var2, ... that point to xml nodes.
我这样说。
<xsl:element name="fo:table-row">
<xsl:element name="fo:table-cell" use-attribute-sets="table-cell">
<xsl:attribute name="number-columns-spanned"> **???** </xsl:element>
<xsl:element name="fo:block">Text that spans over columns</xsl:element>
</xsl:element>
</xsl:element>
<xsl:element name="fo:table-row" use-attribute-sets="headerRow">
<xsl:element name="fo:table-cell" use-attribute-sets="table-cell">
<xsl:element name="fo:block">some value here</xsl:element>
</xsl:element>
<xsl:if test="$var1">
<xsl:element name="fo:table-cell" use-attribute-sets="table-cell">
<xsl:element name="fo:block">maybe some value here 2</xsl:element>
</xsl:element>
</xsl:if>
<xsl:if test="$var2">
<xsl:element name="fo:table-cell" use-attribute-sets="table-cell">
<xsl:element name="fo:block">maybe some value here 3</xsl:element>
</xsl:element>
</xsl:if>
...
</xsl:element>
I m expanding the 1st row to span all over the columns.
"number-columns-spanned" is variable and depends on the number of test that are passing.
Is there an easy way to dynamically extract the number of conditions that are passing in order to correctly define the attribute number-columns-spanned?