Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lindenb
Created August 30, 2018 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lindenb/6b66d062c74097766dcf47912d409448 to your computer and use it in GitHub Desktop.
Save lindenb/6b66d062c74097766dcf47912d409448 to your computer and use it in GitHub Desktop.
biostar Fastqc -> pdf xslt fop Makefile
<?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"
xmlns:fox="http://xml.apache.org/fop/extensions">
<xsl:template match="html">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xml.apache.org/fop/extensions">
<fo:layout-master-set>
<fo:simple-page-master master-name="page-layout">
<fo:region-body margin="2.5cm" region-name="body"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="page-layout">
<xsl:apply-templates select="body"/>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="b">
<fo:inline font-weight="bold">
<xsl:apply-templates select="*|text()"/>
</fo:inline>
</xsl:template>
<xsl:template match="body">
<fo:flow flow-name="body">
<fo:block font-size="48pt" text-align="center">
FASTQC-Report
<fo:inline wrap-option="no-wrap"/>
</fo:block>
<fo:block font-size="24pt" text-align="center">
Pierre Lindenbaum PHD
</fo:block>
<fo:block text-align="center" page-break-before="always" font-size="48pt">
Basic Statistics
</fo:block>
<fo:block>
<xsl:apply-templates select="//h2[@id='M0']/../table[1]"/>
</fo:block>
<xsl:apply-templates select="//img"/>
</fo:flow>
</xsl:template>
<xsl:template match="img">
<xsl:if test="starts-with(@src,'Images/')">
<fo:block text-align="center" page-break-before="always" font-size="48pt">
<xsl:value-of select="@alt"/>
</fo:block>
<fo:block space-after="12pt" width="18cm" >
<fo:external-graphic src="{@src}" content-width="19cm" content-height="12.4cm" scaling="uniform" >
</fo:external-graphic>
</fo:block>
</xsl:if>
</xsl:template>
<xsl:template match="table">
<fo:table >
<xsl:for-each select="tr[1]/td">
<fo:table-column column-width="200pt"/>
</xsl:for-each>
<fo:table-body>
<xsl:apply-templates select="tr[td]"/>
</fo:table-body>
</fo:table>
</xsl:template>
<xsl:template match="tr">
<fo:table-row>
<xsl:apply-templates select="td"/>
</fo:table-row>
</xsl:template>
<xsl:template match="td">
<fo:table-cell>
<fo:block>
<xsl:apply-templates select="*|text()"/>
</fo:block>
</fo:table-cell>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment