1 year ago
#349198
Jon.mo
Apache FOP. XSLT line-through works incorrectly inside a table cell
I am trying to create a table with a struck through text inside cells. I need to render a PNG image using Apache FOP. When I build a PDF file it works correctly, but in a PNG image only even lines are getting crossed.
PDF is on the left, PNG is on the right:
XML:
<xml>
<service-result-list>
<service-result-item>
<service-name>leg</service-name>
</service-result-item>
<service-result-item>
<service-name>arm left</service-name>
</service-result-item>
<service-result-item>
<service-name>head</service-name>
</service-result-item>
<service-result-item>
<service-name>arm right</service-name>
</service-result-item>
</service-result-list>
</xml>
XSLT:
<xsl:attribute-set name="table-cell">
<xsl:attribute name="font-family">ArialNarrow</xsl:attribute>
<xsl:attribute name="font-size">7pt</xsl:attribute>
<xsl:attribute name="text-align">center</xsl:attribute>
<xsl:attribute name="border">solid 1px black</xsl:attribute>
</xsl:attribute-set>
<xsl:template name="table2">
<fo:block-container>
<fo:table table-layout="fixed" width="527px" margin-left="1px">
<fo:table-column column-width="527px"/>
<fo:table-header text-align="center">
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="table-cell">
<fo:block>Service</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:apply-templates select="service-result-list/service-result-item"/>
</fo:table-body>
</fo:table>
</fo:block-container>
</xsl:template>
<xsl:template match="service-result-list/service-result-item">
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="table-cell">
<fo:block text-align="left" text-decoration="line-through"><xsl:value-of select="./service-name"/></fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
xslt
xslt-1.0
xsl-fo
apache-fop
0 Answers
Your Answer