Skip to content

Commit

Permalink
Bug fix- table not displaying in PDF & HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
JennnRamirez committed Nov 20, 2024
1 parent 8f0817d commit db130e1
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 11 deletions.
28 changes: 19 additions & 9 deletions cityehr-quick-start-guide/src/main/xslt/create-topic-html.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@
<xsl:apply-templates mode="body"/>
</xsl:copy>
</xsl:template>

<!-- <xsl:template match="image" mode="body">
<figure>
<img src="{@href}">
<xsl:attribute name="width" select="960"/>
</img>
</figure>
</xsl:template>-->

<xsl:template match="image[alt]" mode="body">
<figure>
Expand All @@ -92,6 +84,24 @@
<figcaption><xsl:value-of select="alt"/></figcaption>
</figure>
</xsl:template>

<xsl:template match="simpletable" mode="body">
<table style="border-collapse: collapse" >
<xsl:apply-templates select="strow" mode="body"/>
</table>
</xsl:template>

<xsl:template match="strow" mode="body">
<tr>
<xsl:apply-templates select="stentry" mode="body"/>
</tr>
</xsl:template>

<xsl:template match="stentry" mode="body">
<td style="padding: 4px; border: 1px solid black;">
<xsl:apply-templates select="node()" mode="body"/>
</td>
</xsl:template>

<xsl:template match="image[empty(alt)]" mode="body">
<img src="{@href}">
Expand All @@ -110,7 +120,7 @@

<xsl:template match="section" mode="body">
<section>
<xsl:apply-templates select="title|p|b|i|ol|ul|li|image|section" mode="body"/>
<xsl:apply-templates select="title|p|b|i|ol|ul|li|image|section|simpletable" mode="body"/>
</section>
</xsl:template>

Expand Down
30 changes: 28 additions & 2 deletions cityehr-quick-start-guide/src/main/xslt/create-topic-pdf.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,41 @@
<!-- PAGE CONTENT -->
<xsl:template match="body" mode="body">
<fo:block id="body-{generate-id()}">
<xsl:apply-templates select="p|section|ol|ul|note" mode="body"/>
<xsl:apply-templates select="p|section|ol|ul|note|simpletable" mode="body"/>
</fo:block>
</xsl:template>

<xsl:template match="simpletable" mode="body">
<fo:table table-layout="fixed" width="100%" border-collapse="collapse" border="1pt solid black">
<!-- column widths -->
<fo:table-column column-width="40%"/>
<fo:table-column column-width="60%"/>
<!-- table body -->
<fo:table-body>
<xsl:apply-templates select="strow" mode="body"/>
</fo:table-body>
</fo:table>
</xsl:template>

<xsl:template match="strow" mode="body">
<fo:table-row>
<xsl:apply-templates select="stentry" mode="body"/>
</fo:table-row>
</xsl:template>

<xsl:template match="stentry" mode="body">
<fo:table-cell border="1pt solid black" padding="4pt">
<fo:block>
<xsl:apply-templates select="node()" mode="body"/>
</fo:block>
</fo:table-cell>
</xsl:template>

<xsl:template match="section" mode="body">
<fo:block background-color="#b08d57" color="#FFFFFF" font-weight="bold" font-size="10pt" display-align="center" margin-bottom="11pt" id="section-{generate-id()}">
<fo:block margin-left="8pt"><xsl:value-of select="title"/></fo:block>
</fo:block>
<xsl:apply-templates select="p|b|i|ol|ul|li|image|section|note" mode="body"/>
<xsl:apply-templates select="p|b|i|ol|ul|li|image|section|note|simpletable" mode="body"/>
</xsl:template>

<xsl:template match="p" mode="body">
Expand Down

0 comments on commit db130e1

Please sign in to comment.