I have a single data set with varying list of the attributes(about 15), like displayed below.
Sample Data 1:
<cd>
<name>Tom</name>
<address>Madison Square</address>
<phone>000-000-0000</phone>
</cd>
Sample Data 2:
<cd>
<name>Tom</name>
<city>New York</city>
<phone>000-000-0000</phone>
</cd>
Complete list of attributes(subset):
<cd>
<name>xxx</name>
<address>xxxx</address>
<city>xxxx</city>
<phone>000-000-0000</phone>
</cd>
I want to build a fo:table with alternate row colors for this dynamic table. I have tried using xsl:for-each and position(), but it doesn't work. Is there a way to get previous row properties like, color? Any suggestions.
Added code for reference:
<fo:table-row>
<fo:table-cell padding-left="3pt" padding-top="8pt">
<fo:block> <xsl:value-of select="cd/name"/></fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:if test="normalize-space(cd/address) !=''">
<fo:table-row background-color="#EEF0F2" >
<fo:table-cell padding-left="3pt" padding-top="8pt">
<fo:block> <xsl:value-of select="cd/address"/></fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
<xsl:if test="normalize-space(cd/city) !=''">
<fo:table-row background-color="#EEF0F2" >
<fo:table-cell padding-left="3pt" padding-top="8pt">
<fo:block> <xsl:value-of select="cd/city"/></fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>