Skip to content

Instantly share code, notes, and snippets.

/MyXsl.xsl Secret

Created May 12, 2017 12:41
Show Gist options
  • Save anonymous/b6b1faadcfd84d375e8168c753113831 to your computer and use it in GitHub Desktop.
Save anonymous/b6b1faadcfd84d375e8168c753113831 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<fo:root>
<fo:layout-master-set>
<fo:simple-page-master master-name="page-master" margin-left="0.60in" margin-right="0.8in" page-height="11.69in" page-width="8.27in" margin-top="0.10in" margin-bottom="0.3in">
<fo:region-body margin-top="1.75in" margin-bottom="0.6in" column-count="1" column-gap="0.50in"/>
<fo:region-before region-name="page-header" extent="1.75in"/>
<fo:region-after region-name="page-footer" extent="0.49in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="page-master" initial-page-number="auto" force-page-count="no-force">
<fo:static-content flow-name="page-header">
<fo:block margin="0pt" wrap-option="wrap">
<xsl:for-each select="Document/TemplateDataGroup">
<fo:table width="100%">
<fo:table-column column-number="1" column-width="76pt"/>
<fo:table-column column-number="2" column-width="76pt"/>
<fo:table-column column-number="3" column-width="76pt"/>
<fo:table-column column-number="4" column-width="76pt"/>
<fo:table-column column-number="5" column-width="76pt"/>
<fo:table-column column-number="6" column-width="76pt"/>
<fo:table-column column-number="7" column-width="76pt"/>
<fo:table-column column-number="8" column-width="76pt"/>
<fo:table-body>
<xsl:for-each select="TemplateDataRow">
<fo:table-row>
<xsl:for-each select="TemplateDataCell">
<fo:table-cell border="1px solid black" padding="5pt">
<xsl:if test="Colspan != ''">
<xsl:attribute name="number-columns-spanned"><xsl:value-of select="Colspan"/></xsl:attribute>
</xsl:if>
<fo:block keep-with-next="always">
<xsl:if test="Type != 'Image'">
<xsl:choose>
<xsl:when test="Text != ''">
<xsl:value-of select="Text"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="Value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</fo:block>
<fo:block>
<xsl:if test="Type = 'Image'">
<fo:external-graphic content-height="0.55in" scaling="uniform" src="{Text}"/>
</xsl:if>
</fo:block>
</fo:table-cell>
</xsl:for-each>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</xsl:for-each>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block>
</fo:block>
</fo:flow>-
</fo:page-sequence>
</fo:root>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment