From Arnaud Heritier :
plugin.jelly :
code reformating,
+ debug mode corrected : uses correctly the project property �maven.pdf.debug� for the style task and the FO transformation,
+ uses a new property �maven.pdf.navigationFile� to specify a navigation file specific to the pdf doc.
plugin.properties :
New property : �maven.pdf.navigationFile�
project.xml :
code reformating,
fo-body.xslt :
code reformating,
+ corrects some problem with external and internal links
+ write the link on the page when the navigation file points to an external link.
fo-table-column-widths.xslt, fo-tables.xslt :
code reformating,
+ add the generation of tables with only tr/td and th.
project2fo.xslt :
code reformating,
+ remove the generation of pages which are not hosted in the project.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114603 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6c0cd25761
commit
afc1323fe1
106
pdf/plugin.jelly
106
pdf/plugin.jelly
@ -1,62 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns:j="jelly:core">
|
||||
|
||||
<goal
|
||||
name="pdf:init"
|
||||
prereqs="xdoc:init">
|
||||
<j:set var="docsXdocSrc"
|
||||
value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.src')}"/>
|
||||
<j:set var="docsGenSrc"
|
||||
value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.gen.docs')}"/>
|
||||
<j:set var="docsPdf"
|
||||
value="${maven.build.dir}/pdf"/>
|
||||
<j:set var="docsToc"
|
||||
value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.src')}/navigation.xml"/>
|
||||
<j:set var="confidential"
|
||||
value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.confidential')}"/>
|
||||
<j:set var="paperType"
|
||||
value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.paperType')}"/>
|
||||
<j:set var="companyName"
|
||||
value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.companyName')}"/>
|
||||
<j:set var="companyIncName"
|
||||
value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.companyIncName')}"/>
|
||||
<j:set var="publicationYear"
|
||||
value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.copyrightYear')}"/>
|
||||
<j:set var="coverProjectCompany"
|
||||
value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.projectCompany')}"/>
|
||||
<j:set var="coverProjectName"
|
||||
value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.projectName')}"/>
|
||||
<j:set var="coverType"
|
||||
value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.type')}"/>
|
||||
<j:set var="coverVersion"
|
||||
value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.version')}"/>
|
||||
<j:set var="coverDate"
|
||||
value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.date')}"/>
|
||||
<j:set var="projectLogo"
|
||||
value="${docsPdf}/images/${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.projectLogo')}"/>
|
||||
<j:set var="companyLogo"
|
||||
value="${docsPdf}/images/${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.companyLogo')}"/>
|
||||
<j:set var="imageDpi"
|
||||
value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.imageDpi')}"/>
|
||||
<j:set var="debug"
|
||||
value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.debug')}"/>
|
||||
<goal name="pdf:init" prereqs="xdoc:init">
|
||||
<j:set var="docsXdocSrc" value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.src')}"/>
|
||||
<j:set var="docsGenSrc" value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.gen.docs')}"/>
|
||||
<j:set var="docsPdf" value="${maven.build.dir}/pdf"/>
|
||||
<j:set var="docsToc" value="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.src')}/${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.navigationFile')}"/>
|
||||
<j:set var="confidential" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.confidential')}"/>
|
||||
<j:set var="paperType" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.paperType')}"/>
|
||||
<j:set var="companyName" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.companyName')}"/>
|
||||
<j:set var="companyIncName" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.companyIncName')}"/>
|
||||
<j:set var="publicationYear" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.copyrightYear')}"/>
|
||||
<j:set var="coverProjectCompany" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.projectCompany')}"/>
|
||||
<j:set var="coverProjectName" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.projectName')}"/>
|
||||
<j:set var="coverType" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.type')}"/>
|
||||
<j:set var="coverVersion" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.version')}"/>
|
||||
<j:set var="coverDate" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.cover.date')}"/>
|
||||
<j:set var="projectLogo" value="${docsPdf}/images/${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.projectLogo')}"/>
|
||||
<j:set var="companyLogo" value="${docsPdf}/images/${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.companyLogo')}"/>
|
||||
<j:set var="imageDpi" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.imageDpi')}"/>
|
||||
<j:set var="debug" value="${pom.getPluginContext('maven-pdf-plugin').getVariable('maven.pdf.debug')}"/>
|
||||
<mkdir dir="${docsPdf}"/>
|
||||
</goal>
|
||||
|
||||
<goal
|
||||
name="fo"
|
||||
prereqs="fo:fo"
|
||||
description="Generate XSL:FO project documentation"/>
|
||||
|
||||
<goal name="fo:fo"
|
||||
prereqs="pdf:prepare"
|
||||
description="Generate XSL:FO project documentation">
|
||||
<goal name="fo" prereqs="fo:fo" description="Generate XSL:FO project documentation"/>
|
||||
<goal name="fo:fo" prereqs="pdf:prepare" description="Generate XSL:FO project documentation">
|
||||
<echo>Generating ${docsDest}/project.fo ...</echo>
|
||||
<available file="${docsToc}"
|
||||
property="maven.fo.navigation.available"/>
|
||||
<fail message="PDF generation cannot complete as ${docsToc} is missing"
|
||||
unless="maven.fo.navigation.available"/>
|
||||
<available file="${docsToc}" property="maven.fo.navigation.available"/>
|
||||
<fail message="PDF generation cannot complete as ${docsToc} is missing" unless="maven.fo.navigation.available"/>
|
||||
<!-- 'Major hack.' Stolen from the Latka plugin.jelly. All of this could be avoided by putting
|
||||
xalan into $MAVEN_HOME/lib/endorsed directory in the distribution, but never mind -->
|
||||
${systemScope.setProperty('javax.xml.transform.TransformerFactory','org.apache.xalan.processor.TransformerFactoryImpl')}
|
||||
@ -78,16 +47,8 @@
|
||||
<param name="debug" expression="${debug}"/>
|
||||
</style>
|
||||
</goal>
|
||||
|
||||
<goal
|
||||
name="pdf"
|
||||
prereqs="fo:fo,pdf:prepare,pdf:pdf"
|
||||
description="Generate PDF project documentation"/>
|
||||
|
||||
<goal
|
||||
name="pdf:prepare"
|
||||
prereqs="pdf:init"
|
||||
description="Stages all files needed to generate the PDF">
|
||||
<goal name="pdf" prereqs="fo:fo,pdf:prepare,pdf:pdf" description="Generate PDF project documentation"/>
|
||||
<goal name="pdf:prepare" prereqs="pdf:init" description="Stages all files needed to generate the PDF">
|
||||
<!-- First, copy all of the generated xdocs -->
|
||||
<copy todir="${docsPdf}">
|
||||
<fileset dir="${docsGenSrc}" force="true">
|
||||
@ -108,9 +69,7 @@
|
||||
</fileset>
|
||||
</copy>
|
||||
</goal>
|
||||
|
||||
<goal name="pdf:pdf" description="Generate PDF project documentation"
|
||||
prereqs="pdf:prepare">
|
||||
<goal name="pdf:pdf" description="Generate PDF project documentation" prereqs="pdf:prepare">
|
||||
<echo>Generating ${docsPdf}/project.pdf ...</echo>
|
||||
<echo>Config file: ${docsPdf}/userconfig.xml</echo>
|
||||
<java classname="org.apache.fop.apps.Fop" fork="yes" failonerror="true" maxmemory="500m">
|
||||
@ -121,15 +80,14 @@
|
||||
<pathelement location="${plugin.getDependencyPath('avalon-framework')}"/>
|
||||
<pathelement location="${plugin.getDependencyPath('xerces')}"/>
|
||||
</classpath>
|
||||
<arg value="-c" />
|
||||
<arg value="${docsPdf}/userconfig.xml" />
|
||||
<arg value="-d" />
|
||||
<arg value="-fo" />
|
||||
<arg value="${docsPdf}/project.fo" />
|
||||
<arg value="-pdf" />
|
||||
<arg value="-c"/>
|
||||
<arg value="${docsPdf}/userconfig.xml"/>
|
||||
<j:if test="${debug}"><arg value="-d"/></j:if>
|
||||
<arg value="-fo"/>
|
||||
<arg value="${docsPdf}/project.fo"/>
|
||||
<arg value="-pdf"/>
|
||||
<arg value="${docsPdf}/project.pdf"/>
|
||||
<sysproperty key="javax.xml.transform.TransformerFactory" value="org.apache.xalan.processor.TransformerFactoryImpl"/>
|
||||
</java>
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
|
||||
@ -10,6 +10,7 @@ maven.pdf.companyIncName=${pom.organization.name}
|
||||
maven.pdf.copyrightYear=${pom.inceptionYear}
|
||||
maven.pdf.imageDpi=150
|
||||
maven.pdf.debug=false
|
||||
maven.pdf.navigationFile=navigation.xml
|
||||
# Reserved for future use...
|
||||
maven.pdf.cover.projectCompany=${pom.organization.name}
|
||||
maven.pdf.cover.projectName=${pom.name}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project>
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
@ -37,6 +36,15 @@
|
||||
<role>Release Manager</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Emmanuel Venisse</name>
|
||||
<id>evenisse</id>
|
||||
<email>emmanuel@venisse.net</email>
|
||||
<organization></organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
<contributors>
|
||||
<contributor>
|
||||
@ -44,6 +52,11 @@
|
||||
<email>arjaquith@mindspring.com</email>
|
||||
<organization>freshcookies.org</organization>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Arnaud Heritier</name>
|
||||
<email></email>
|
||||
<organization></organization>
|
||||
</contributor>
|
||||
</contributors>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@ -1,36 +1,28 @@
|
||||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
|
||||
<!-- These attribute-sets are treated as 'styles,'
|
||||
and are referenced in the templates below -->
|
||||
|
||||
<!-- Style 'primitives' from which all others are descended -->
|
||||
<xsl:attribute-set name="base.body.style">
|
||||
<xsl:attribute name="font-family">Garamond,serif</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="base.heading.style">
|
||||
<xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
|
||||
<xsl:attribute name="color">#000000</xsl:attribute>
|
||||
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="base.pre.style">
|
||||
<xsl:attribute name="font-family">monospace</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Standard body and heading styles -->
|
||||
<xsl:attribute-set name="body.text" use-attribute-sets="base.body.style">
|
||||
<xsl:attribute name="font-size">11pt</xsl:attribute>
|
||||
<xsl:attribute name="line-height">12pt</xsl:attribute>
|
||||
<xsl:attribute name="white-space-collapse">true</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="body.pre" use-attribute-sets="base.pre.style">
|
||||
<xsl:attribute name="font-size">10pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="body.source" use-attribute-sets="base.pre.style">
|
||||
<xsl:attribute name="font-size">8pt</xsl:attribute>
|
||||
<xsl:attribute name="wrap-option">wrap</xsl:attribute>
|
||||
@ -48,63 +40,52 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
<xsl:attribute name="space-before">0.75em</xsl:attribute>
|
||||
<xsl:attribute name="space-after">1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="body.strong">
|
||||
<xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
|
||||
<xsl:attribute name="font-size">9.0pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="body.title" use-attribute-sets="base.heading.style">
|
||||
<xsl:attribute name="font-size">16pt</xsl:attribute>
|
||||
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="body.h1" use-attribute-sets="base.heading.style">
|
||||
<xsl:attribute name="font-size">12pt</xsl:attribute>
|
||||
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
||||
<xsl:attribute name="space-before">18pt</xsl:attribute>
|
||||
<xsl:attribute name="space-after">6pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="body.h2" use-attribute-sets="base.heading.style">
|
||||
<xsl:attribute name="font-size">9.5pt</xsl:attribute>
|
||||
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
||||
<xsl:attribute name="space-before">18pt</xsl:attribute>
|
||||
<xsl:attribute name="space-after">5pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="body.h3" use-attribute-sets="base.heading.style">
|
||||
<xsl:attribute name="font-size">9.5pt</xsl:attribute>
|
||||
<xsl:attribute name="space-before">15pt</xsl:attribute>
|
||||
<xsl:attribute name="space-after">3pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="body.h4" use-attribute-sets="base.heading.style">
|
||||
<xsl:attribute name="font-size">9.5pt</xsl:attribute>
|
||||
<xsl:attribute name="space-before">9pt</xsl:attribute>
|
||||
<xsl:attribute name="space-after">3pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="body.h5" use-attribute-sets="base.heading.style">
|
||||
<xsl:attribute name="font-size">9.5pt</xsl:attribute>
|
||||
<xsl:attribute name="font-style">italic</xsl:attribute>
|
||||
<xsl:attribute name="space-after">3pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
|
||||
<!-- Chapter heading styles -->
|
||||
<xsl:attribute-set name="chapter.title" use-attribute-sets="base.heading.style body.title">
|
||||
<xsl:attribute name="line-height">10pt</xsl:attribute>
|
||||
<xsl:attribute name="space-after">6pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="chapter.rule">
|
||||
<xsl:attribute name="leader-length.optimum">100%</xsl:attribute>
|
||||
<xsl:attribute name="leader-pattern">dots</xsl:attribute>
|
||||
<xsl:attribute name="rule-thickness">1pt</xsl:attribute>
|
||||
<xsl:attribute name="color"><xsl:value-of select="$colorDarkGray"/></xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Outdented numbers -->
|
||||
<xsl:attribute-set name="outdented.number.style" use-attribute-sets="base.heading.style">
|
||||
<xsl:attribute name="font-size">9.5pt</xsl:attribute>
|
||||
@ -112,7 +93,6 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
<xsl:attribute name="line-height">10pt</xsl:attribute>
|
||||
<xsl:attribute name="text-align">right</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Page header/footer styles -->
|
||||
<xsl:attribute-set name="footer.style">
|
||||
<xsl:attribute name="letter-spacing">2pt</xsl:attribute>
|
||||
@ -120,7 +100,6 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
<xsl:attribute name="font-size">6pt</xsl:attribute>
|
||||
<xsl:attribute name="color"><xsl:value-of select="$colorDarkGray"/></xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="header.style">
|
||||
<xsl:attribute name="letter-spacing">2pt</xsl:attribute>
|
||||
<xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
|
||||
@ -128,61 +107,51 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
<xsl:attribute name="color"><xsl:value-of select="$colorDarkGray"/></xsl:attribute>
|
||||
<xsl:attribute name="text-align">left</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="page.number">
|
||||
<xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
|
||||
<xsl:attribute name="font-size">9.5pt</xsl:attribute>
|
||||
<xsl:attribute name="text-align">right</xsl:attribute>
|
||||
<xsl:attribute name="color">black</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Style for hyperlinks -->
|
||||
<xsl:attribute-set name="href">
|
||||
<xsl:attribute name="color">black</xsl:attribute>
|
||||
<xsl:attribute name="color">blue</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- 'Normal' line-spacing styles for paragraph and pre elements -->
|
||||
<xsl:attribute-set name="normal.paragraph" use-attribute-sets="base.body.style">
|
||||
<xsl:attribute name="space-before">3pt</xsl:attribute>
|
||||
<xsl:attribute name="space-after">6pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Styles for lists, list items, definition lists, etc. -->
|
||||
<xsl:attribute-set name="list">
|
||||
<xsl:attribute name="start-indent">inherited-property-value(start-indent)</xsl:attribute>
|
||||
<xsl:attribute name="provisional-distance-between-starts">1em</xsl:attribute>
|
||||
<xsl:attribute name="provisional-label-separation">1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- 1pt before, 3pts after -->
|
||||
<xsl:attribute-set name="list.item">
|
||||
<xsl:attribute name="start-indent">inherited-property-value(start-indent) + .5em</xsl:attribute>
|
||||
<xsl:attribute name="space-before">0.15em</xsl:attribute>
|
||||
<xsl:attribute name="space-after">0.25em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="dl" use-attribute-sets="body.text">
|
||||
<xsl:attribute name="start-indent">1em</xsl:attribute>
|
||||
<xsl:attribute name="end-indent">1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="dt" use-attribute-sets="base.body.style">
|
||||
<xsl:attribute name="start-indent">1em</xsl:attribute>
|
||||
<xsl:attribute name="end-indent">1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="dd" use-attribute-sets="base.body.style">
|
||||
<xsl:attribute name="start-indent">1em</xsl:attribute>
|
||||
<xsl:attribute name="end-indent">1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before">0.6em</xsl:attribute>
|
||||
<xsl:attribute name="space-after">0.6em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
|
||||
<!-- Templates for rendering headers, footers, and chapter headings -->
|
||||
<xsl:template name="body-header">
|
||||
<xsl:param name="headerText"></xsl:param>
|
||||
<xsl:param name="pageNumber"></xsl:param>
|
||||
<xsl:param name="headerText"/>
|
||||
<xsl:param name="pageNumber"/>
|
||||
<xsl:variable name="leftCol" select="0.9 * $maxBodyWidth"/>
|
||||
<xsl:variable name="rightCol" select="0.1 * $maxBodyWidth"/>
|
||||
<fo:static-content flow-name="xsl-region-before">
|
||||
@ -198,7 +167,7 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell>
|
||||
<fo:block xsl:use-attribute-sets="page.number">
|
||||
<fo:page-number />
|
||||
<fo:page-number/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
@ -206,23 +175,27 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</fo:table>
|
||||
</fo:static-content>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="body-footer">
|
||||
<xsl:param name="footerText"></xsl:param>
|
||||
<xsl:param name="footerText"/>
|
||||
<fo:static-content flow-name="xsl-region-after">
|
||||
<fo:block xsl:use-attribute-sets="footer.style">
|
||||
<xsl:value-of select="normalize-space($footerText)"/>
|
||||
</fo:block>
|
||||
</fo:static-content>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="body-chapter-heading">
|
||||
<xsl:param name="chapterNumber"></xsl:param>
|
||||
<xsl:param name="chapter"></xsl:param>
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<xsl:param name="chapter"/>
|
||||
<xsl:variable name="gutter">0.125</xsl:variable>
|
||||
<xsl:variable name="leftMargin"><xsl:value-of select="$bodySideMargins"/></xsl:variable>
|
||||
<xsl:variable name="rightMargin"><xsl:value-of select="$bodySideMargins"/></xsl:variable>
|
||||
<xsl:variable name="bodyWidth"><xsl:value-of select="$maxBodyWidth"/></xsl:variable>
|
||||
<xsl:variable name="leftMargin">
|
||||
<xsl:value-of select="$bodySideMargins"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="rightMargin">
|
||||
<xsl:value-of select="$bodySideMargins"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="bodyWidth">
|
||||
<xsl:value-of select="$maxBodyWidth"/>
|
||||
</xsl:variable>
|
||||
<fo:block>
|
||||
<fo:list-block provisional-distance-between-starts="{$leftMargin}in" provisional-label-separation="{$gutter}in">
|
||||
<fo:list-item>
|
||||
@ -243,63 +216,80 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
<!-- Add a rule underneath -->
|
||||
<fo:leader xsl:use-attribute-sets="chapter.rule"/>
|
||||
</fo:block>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Templates for rendering xdoc tags -->
|
||||
<xsl:template match="document/body">
|
||||
<xsl:apply-templates />
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="section">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:block xsl:use-attribute-sets="body.h1">
|
||||
<xsl:value-of select="@name" />
|
||||
<xsl:value-of select="@name"/>
|
||||
</fo:block>
|
||||
<fo:block xsl:use-attribute-sets="body.text">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="subsection">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:block xsl:use-attribute-sets="body.h2">
|
||||
<xsl:value-of select="@name" />
|
||||
<xsl:value-of select="@name"/>
|
||||
</fo:block>
|
||||
<fo:block xsl:use-attribute-sets="body.text">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="p[@style='h3']">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:block xsl:use-attribute-sets="body.h3">
|
||||
<xsl:value-of select="normalize-space(.)"/>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="p[@style='h4']">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:block xsl:use-attribute-sets="body.h4">
|
||||
<xsl:value-of select="normalize-space(.)"/>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="p[@style='h5']">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:block xsl:use-attribute-sets="body.h5">
|
||||
<xsl:value-of select="normalize-space(.)"/>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="p">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:block xsl:use-attribute-sets="body.text normal.paragraph">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="source">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:block xsl:use-attribute-sets="body.source">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="img[@src]">
|
||||
<xsl:variable name="source">
|
||||
<xsl:choose>
|
||||
@ -324,122 +314,194 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
<xsl:choose>
|
||||
<xsl:when test="parent::section | parent::subsection">
|
||||
<fo:block>
|
||||
<fo:external-graphic src="{normalize-space($source)}"
|
||||
height="{$height}in" width="{$width}in"
|
||||
content-height="auto" content-width="auto" />
|
||||
<fo:external-graphic src="{normalize-space($source)}" height="{$height}in" width="{$width}in" content-height="auto" content-width="auto"/>
|
||||
</fo:block>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<fo:external-graphic src="{normalize-space($source)}"
|
||||
height="{$height}in" width="{$width}in"
|
||||
content-height="auto" content-width="auto" />
|
||||
<fo:external-graphic src="{normalize-space($source)}" height="{$height}in" width="{$width}in" content-height="auto" content-width="auto"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Templates for handling XHTML tags -->
|
||||
|
||||
<xsl:template match="a[@href and not(ancestor::table) and starts-with(@href, 'http')]">
|
||||
<xsl:template match="a[@href and not(ancestor::table) and (starts-with(@href, 'http') or starts-with(@href, 'mailto') or starts-with(@href, 'ftp'))]">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:basic-link external-destination="{@href}">
|
||||
<fo:inline xsl:use-attribute-sets="href">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</fo:basic-link>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="a[@href and not(ancestor::table) and not(starts-with(@href, 'http'))]">
|
||||
<xsl:template match="a[@href and not(ancestor::table) and starts-with(@href, '#')]">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:basic-link internal-destination="{$chapterNumber}{@href}">
|
||||
<fo:inline xsl:use-attribute-sets="href">
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</fo:basic-link>
|
||||
</xsl:template>
|
||||
<xsl:template match="a[@href and not(ancestor::table) and not(starts-with(@href, 'http')) and not(starts-with(@href, '#'))]">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:basic-link internal-destination="{@href}{generate-id()}">
|
||||
<fo:inline xsl:use-attribute-sets="href">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</fo:basic-link>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="a[@name]">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:block id="{$chapterNumber}#{@name}">
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
<xsl:template match="br">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:block/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="em | i">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:inline font-style="italic">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="b | strong[ancestor::table]">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:inline font-weight="bold">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="strong[ancestor::p|ancestor::li|ancestor::dl|ancestor::dt|ancestor::dd]">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:inline font-weight="bold" xsl:use-attribute-sets="body.strong">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="strong">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:inline font-weight="bold">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="sub">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:inline baseline-shift="sub">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="sup">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:inline baseline-shift="sup">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="tt|code">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:inline xsl:use-attribute-sets="body.pre">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="var">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:inline font-style="italic">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="big">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:inline font-size="larger">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="small">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:inline font-size="smaller">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="ul/ul | ul/ol | ol/ul | ol/ol">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:list-item xsl:use-attribute-sets="list.item">
|
||||
<fo:list-item-label>
|
||||
<fo:block />
|
||||
<fo:block/>
|
||||
</fo:list-item-label>
|
||||
<fo:list-item-body start-indent="body-start()">
|
||||
<fo:block>
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:block>
|
||||
</fo:list-item-body>
|
||||
</fo:list-item>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="ul | ol">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:list-block xsl:use-attribute-sets="list">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:list-block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="ul/li">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:list-item xsl:use-attribute-sets="list.item">
|
||||
<fo:list-item-label>
|
||||
<fo:block>
|
||||
@ -450,45 +512,62 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</fo:list-item-label>
|
||||
<fo:list-item-body start-indent="body-start()">
|
||||
<fo:block>
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:block>
|
||||
</fo:list-item-body>
|
||||
</fo:list-item>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="ol/li">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:list-item xsl:use-attribute-sets="list.item">
|
||||
<fo:list-item-label>
|
||||
<fo:block>
|
||||
<xsl:number format="1." />
|
||||
<xsl:number format="1."/>
|
||||
</fo:block>
|
||||
</fo:list-item-label>
|
||||
<fo:list-item-body start-indent="body-start()">
|
||||
<fo:block>
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:block>
|
||||
</fo:list-item-body>
|
||||
</fo:list-item>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="dl">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:block xsl:use-attribute-sets="dl">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="dt">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:block xsl:use-attribute-sets="dt">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="dd">
|
||||
<xsl:param name="chapterNumber"/>
|
||||
<fo:block xsl:use-attribute-sets="dd">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
|
||||
<!-- This is a dummy entry -->
|
||||
<xsl:variable name="masklookup">----------111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999"</xsl:variable>
|
||||
<xsl:variable name="columnWidths"> 5? 5? 5? 5? 5? 5? 5? 5? 5? 5?</xsl:variable>
|
||||
|
||||
<xsl:template name="calculate-column-widths">
|
||||
<xsl:param name="row">1</xsl:param>
|
||||
<xsl:param name="col">1</xsl:param>
|
||||
@ -13,21 +10,23 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
<xsl:param name="nextmask"> ----------</xsl:param>
|
||||
<xsl:param name="widths" select="$columnWidths"/>
|
||||
<!-- Get current row and column based on (row,col) parameters -->
|
||||
<xsl:variable name="currentRow"
|
||||
select="thead/tr[position()=$row]"/>
|
||||
<xsl:variable name="currentCol"
|
||||
select="thead/tr[position()=$row]/th[position()=$col]"/>
|
||||
<xsl:variable name="currentRow" select="thead/tr[position()=$row]"/>
|
||||
<xsl:variable name="currentCol" select="thead/tr[position()=$row]/th[position()=$col]"/>
|
||||
<!-- Determine the row/colspans for the current cell
|
||||
If not specified, they default to 1 -->
|
||||
<xsl:variable name="colspan">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentCol/@colspan"><xsl:value-of select="$currentCol/@colspan"/></xsl:when>
|
||||
<xsl:when test="$currentCol/@colspan">
|
||||
<xsl:value-of select="$currentCol/@colspan"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>1</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="rowspan">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentCol/@rowspan"><xsl:value-of select="$currentCol/@rowspan"/></xsl:when>
|
||||
<xsl:when test="$currentCol/@rowspan">
|
||||
<xsl:value-of select="$currentCol/@rowspan"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>1</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
@ -81,7 +80,9 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
$cellwidthmask,
|
||||
substring($widths, ($ins - 2 + $colspan)*4+1))"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="$widths"/></xsl:otherwise>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$widths"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<!-- Revise the the current row's mask by inserting
|
||||
@ -101,11 +102,14 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</xsl:variable>
|
||||
<!-- Print debugging information -->
|
||||
<xsl:if test="$debug = 'true'">
|
||||
<xsl:message>Cell (<xsl:value-of select="$row"/>,<xsl:value-of select="$col"/>) text()='<xsl:value-of select="normalize-space($currentCol)"/>' rowspan=<xsl:value-of select="$rowspan"/> colspan=<xsl:value-of select="$colspan"/> width=<xsl:value-of select="normalize-space($cellwidthRaw * $colspan)"/></xsl:message>
|
||||
<xsl:message>Cell (<xsl:value-of select="$row"/>,<xsl:value-of select="$col"/>) text()='<xsl:value-of select="normalize-space($currentCol)"/>' rowspan=<xsl:value-of select="$rowspan"/> colspan=<xsl:value-of select="$colspan"/> width=<xsl:value-of select="normalize-space($cellwidthRaw * $colspan)"/>
|
||||
</xsl:message>
|
||||
<xsl:message> Current cell mask : <xsl:value-of select="$mask"/>in <xsl:value-of select="$mask2"/>out</xsl:message>
|
||||
<xsl:message> Next row mask : <xsl:value-of select="$nextmask"/>in <xsl:value-of select="$nextmask2"/>out</xsl:message>
|
||||
<xsl:message> Estimated cell widths: <xsl:value-of select="$cellwidthmask"/></xsl:message>
|
||||
<xsl:message> Cell widths so far : <xsl:value-of select="$widths2"/></xsl:message>
|
||||
<xsl:message> Estimated cell widths: <xsl:value-of select="$cellwidthmask"/>
|
||||
</xsl:message>
|
||||
<xsl:message> Cell widths so far : <xsl:value-of select="$widths2"/>
|
||||
</xsl:message>
|
||||
</xsl:if>
|
||||
<!-- What to do next? -->
|
||||
<xsl:choose>
|
||||
@ -130,8 +134,7 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="totals">
|
||||
<xsl:with-param name="columns"
|
||||
select="string-length(substring-before(concat($mask2,'-'),'-'))-1"/>
|
||||
<xsl:with-param name="columns" select="string-length(substring-before(concat($mask2,'-'),'-'))-1"/>
|
||||
<xsl:with-param name="widths" select="$widths2"/>
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
@ -139,7 +142,6 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="totals">
|
||||
<xsl:param name="col">1</xsl:param>
|
||||
<xsl:param name="columns">1</xsl:param>
|
||||
@ -176,7 +178,8 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:if test="$debug = 'true'">
|
||||
<xsl:message>Columns= <xsl:value-of select="$columns"/> (<xsl:value-of select="$softColumns"/> resizable), width=<xsl:value-of select="$sumwidths"/>, leftover=<xsl:value-of select="$leftover"/></xsl:message>
|
||||
<xsl:message>Columns= <xsl:value-of select="$columns"/> (<xsl:value-of select="$softColumns"/> resizable), width=<xsl:value-of select="$sumwidths"/>, leftover=<xsl:value-of select="$leftover"/>
|
||||
</xsl:message>
|
||||
</xsl:if>
|
||||
<xsl:call-template name="print-columns">
|
||||
<xsl:with-param name="columns" select="$columns"/>
|
||||
@ -188,7 +191,6 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="print-columns">
|
||||
<xsl:param name="col">1</xsl:param>
|
||||
<xsl:param name="columns">1</xsl:param>
|
||||
@ -209,8 +211,7 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</xsl:variable>
|
||||
<!-- And now, the moment we've all been waiting for -->
|
||||
<fo:table-column>
|
||||
<xsl:attribute name="column-width">
|
||||
<xsl:value-of select="$colwidth2 div $sumwidths * $maxTableWidth"/>in
|
||||
<xsl:attribute name="column-width"><xsl:value-of select="$colwidth2 div $sumwidths * $maxTableWidth"/>in
|
||||
</xsl:attribute>
|
||||
</fo:table-column>
|
||||
<!-- Loop to the next column -->
|
||||
@ -227,4 +228,146 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Calculate column widths for tables without thead -->
|
||||
<xsl:template name="html-calculate-column-widths">
|
||||
<xsl:param name="row">1</xsl:param>
|
||||
<xsl:param name="col">1</xsl:param>
|
||||
<xsl:param name="mask"> ----------</xsl:param>
|
||||
<xsl:param name="nextmask"> ----------</xsl:param>
|
||||
<xsl:param name="widths" select="$columnWidths"/>
|
||||
<!-- Get current row and column based on (row,col) parameters -->
|
||||
<xsl:variable name="currentRow" select="tr[position()=$row]"/>
|
||||
<xsl:variable name="currentCol" select="tr[position()=$row]/th[position()=$col]|tr[position()=$row]/td[position()=$col]"/>
|
||||
<!-- Determine the row/colspans for the current cell
|
||||
If not specified, they default to 1 -->
|
||||
<xsl:variable name="colspan">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentCol/@colspan">
|
||||
<xsl:value-of select="$currentCol/@colspan"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>1</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="rowspan">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentCol/@rowspan">
|
||||
<xsl:value-of select="$currentCol/@rowspan"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>1</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<!-- Based on the current row mask, determine where to insert the current cell mask -->
|
||||
<xsl:variable name="insmask-row">
|
||||
<xsl:value-of select="substring($masklookup, $rowspan *10+1, $colspan)"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="insmask-nextrow">
|
||||
<xsl:value-of select="substring($masklookup, ($rowspan - 1)*10+1, $colspan)"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="ins">
|
||||
<xsl:value-of select="string-length(substring-before($mask,'-')) + 1"/>
|
||||
</xsl:variable>
|
||||
<!-- If this cell has a width attribute, extract it and normalize to one column.
|
||||
Also, pad it to three characters wide. If the current column is more than one
|
||||
column wide, append the padded width with a '?' so that it can be overridden. -->
|
||||
<xsl:variable name="cellwidthRaw">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentCol/@width">
|
||||
<xsl:if test="contains($currentCol/@width,'%')">
|
||||
<xsl:value-of select="substring-before($currentCol/@width,'%') div $colspan"/>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="cellwidth">
|
||||
<xsl:if test="$cellwidthRaw > 0">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$colspan = 1">
|
||||
<xsl:value-of select="concat(substring(' ', 1, 3 - string-length(round($cellwidthRaw))), round($cellwidthRaw), ' ')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat(substring(' ', 1, 3 - string-length(round($cellwidthRaw))), round($cellwidthRaw), '?')"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<!-- Create a width 'mask' that repeats the width string i times, where i is the
|
||||
number of columns spanned -->
|
||||
<xsl:variable name="cellwidthmaskRaw">
|
||||
<xsl:value-of select="translate('abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd', 'abcd',$cellwidth)"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="cellwidthmask">
|
||||
<xsl:value-of select="substring($cellwidthmaskRaw, 1, $colspan * 4)"/>
|
||||
</xsl:variable>
|
||||
<!-- Insert the cell width, if supplied, into the registry -->
|
||||
<xsl:variable name="widths2">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$cellwidthRaw > 0 and substring($widths, ($ins - 2)*4+4, 1) = '?'">
|
||||
<xsl:value-of select="concat(substring($widths, 1, ($ins - 2)*4),
|
||||
$cellwidthmask,
|
||||
substring($widths, ($ins - 2 + $colspan)*4+1))"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$widths"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<!-- Revise the the current row's mask by inserting
|
||||
a digit j (repeated k times) into the first available space in the
|
||||
mask. J represents the number of rowspans for the current cell
|
||||
the supplied masks. We insert the same number of j into the next row's
|
||||
mask also. -->
|
||||
<xsl:variable name="mask2">
|
||||
<xsl:value-of select="concat(substring($mask, 1, $ins - 1),
|
||||
$insmask-row,
|
||||
substring($mask, $ins + $colspan))"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="nextmask2">
|
||||
<xsl:value-of select="concat(substring($nextmask, 1, $ins - 1),
|
||||
$insmask-nextrow,
|
||||
substring($nextmask, $ins + $colspan))"/>
|
||||
</xsl:variable>
|
||||
<!-- Print debugging information -->
|
||||
<xsl:if test="$debug = 'true'">
|
||||
<xsl:message>Cell (<xsl:value-of select="$row"/>,<xsl:value-of select="$col"/>) text()='<xsl:value-of select="normalize-space($currentCol)"/>' rowspan=<xsl:value-of select="$rowspan"/> colspan=<xsl:value-of select="$colspan"/> width=<xsl:value-of select="normalize-space($cellwidthRaw * $colspan)"/>
|
||||
</xsl:message>
|
||||
<xsl:message> Current cell mask : <xsl:value-of select="$mask"/>in <xsl:value-of select="$mask2"/>out</xsl:message>
|
||||
<xsl:message> Next row mask : <xsl:value-of select="$nextmask"/>in <xsl:value-of select="$nextmask2"/>out</xsl:message>
|
||||
<xsl:message> Estimated cell widths: <xsl:value-of select="$cellwidthmask"/>
|
||||
</xsl:message>
|
||||
<xsl:message> Cell widths so far : <xsl:value-of select="$widths2"/>
|
||||
</xsl:message>
|
||||
</xsl:if>
|
||||
<!-- What to do next? -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="tr[position()=$row]/th[position()=$col+1]|tr[position()=$row]/td[position()=$col+1]">
|
||||
<xsl:call-template name="html-calculate-column-widths">
|
||||
<xsl:with-param name="row" select="$row"/>
|
||||
<xsl:with-param name="col" select="$col+1"/>
|
||||
<xsl:with-param name="mask" select="$mask2"/>
|
||||
<xsl:with-param name="nextmask" select="$nextmask2"/>
|
||||
<xsl:with-param name="widths" select="$widths2"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test="tr[position()=$row+1]">
|
||||
<xsl:call-template name="html-calculate-column-widths">
|
||||
<xsl:with-param name="row" select="$row+1"/>
|
||||
<xsl:with-param name="col" select="1"/>
|
||||
<xsl:with-param name="mask" select="translate($mask2, '123456789', '-12345678')"/>
|
||||
<xsl:with-param name="widths" select="$widths2"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="totals">
|
||||
<xsl:with-param name="columns" select="string-length(substring-before(concat($mask2,'-'),'-'))-1"/>
|
||||
<xsl:with-param name="widths" select="$widths2"/>
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
@ -141,12 +141,221 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
|
||||
|
||||
<!-- Table rendering -->
|
||||
|
||||
<!--
|
||||
<xsl:template match="table[count(thead)=0]">
|
||||
<fo:block xsl:use-attribute-sets="error.block">
|
||||
Warning: the supplied <table> did not contain a <thead> element. It was excluded from the generated XSL:FO file.
|
||||
</fo:block>
|
||||
|
||||
</xsl:template>
|
||||
-->
|
||||
|
||||
<!-- HTML tables generation without THEAD and TBODY -->
|
||||
|
||||
<xsl:template match="table[count(thead)=0]" name="html-find-max-columns">
|
||||
<!-- Before we do anything, we need to scan the table to find the maximum span -->
|
||||
<xsl:param name="row">1</xsl:param>
|
||||
<xsl:param name="maxColumns">1</xsl:param>
|
||||
<!-- Get current row based on $row parameter -->
|
||||
<xsl:variable name="currentRow" select="tr[position()=$row]"/>
|
||||
<!-- Calculate the number of columns in this row. This will be the number
|
||||
of th cells that don't have @colspan attributes, plus the sum of all
|
||||
@colspan attributes in th cells that have them.
|
||||
This algorithm isn't foolproof, because table headers with overlapping
|
||||
rowspans could hose the counting under certain conditions.
|
||||
-->
|
||||
<xsl:variable name="nColumns" select="count($currentRow/th) + count($currentRow/tr) + sum($currentRow/th/@colspan) + sum($currentRow/tr/@colspan) - count($currentRow/th/@colspan) - count($currentRow/tr/@colspan)"/>
|
||||
<xsl:variable name="newMaxColumns">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$nColumns > $maxColumns"><xsl:value-of select="$nColumns"/></xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="$maxColumns"/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<!-- Iterate through the template again if there are more rows -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="tr[position()=$row+1]">
|
||||
<xsl:call-template name="html-find-max-columns">
|
||||
<xsl:with-param name="row" select="$row+1"/>
|
||||
<xsl:with-param name="maxColumns" select="$newMaxColumns"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="html-print-table">
|
||||
<xsl:with-param name="spacerSpanColumns" select="$newMaxColumns"/>
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="table3" name="html-print-table">
|
||||
<xsl:param name="spacerSpanColumns">1</xsl:param>
|
||||
<xsl:comment> :::::: New table :::::: </xsl:comment>
|
||||
<fo:block xsl:use-attribute-sets="table.padding">
|
||||
<fo:table table-layout="fixed" table-omit-footer-at-break="false">
|
||||
<!-- The next template calculates table column widths e.g.,...
|
||||
<fo:table-column column-width="1.25in"/>
|
||||
<fo:table-column column-width="5.0in"/>
|
||||
-->
|
||||
<xsl:call-template name="html-calculate-column-widths" />
|
||||
<fo:table-header>
|
||||
<!-- If there is a 'title' attribute, output a title row -->
|
||||
<xsl:if test="@title">
|
||||
<xsl:comment> This table has a @title, so add a row for it </xsl:comment>
|
||||
<fo:table-row keep-together="always" keep-with-next="always">
|
||||
<fo:table-cell number-columns-spanned="{$spacerSpanColumns}" xsl:use-attribute-sets="table.title.cell">
|
||||
<fo:block xsl:use-attribute-sets="table.title.block"><xsl:value-of select="@title"/></fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</xsl:if>
|
||||
</fo:table-header>
|
||||
<!-- If there is a caption element, output a table-footer -->
|
||||
<fo:table-footer>
|
||||
<!-- If there is a caption, add it -->
|
||||
<xsl:if test="caption">
|
||||
<xsl:comment> This table has a caption, so add a row for it </xsl:comment>
|
||||
<fo:table-row>
|
||||
<fo:table-cell number-columns-spanned="{$spacerSpanColumns}" xsl:use-attribute-sets="table.footer.cell">
|
||||
<fo:block xsl:use-attribute-sets="table.footer.block">
|
||||
<xsl:value-of select="caption"/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</xsl:if>
|
||||
<!-- Put in a sequential table number -->
|
||||
<!--
|
||||
<fo:table-row>
|
||||
<fo:table-cell number-columns-spanned="{$spacerSpanColumns}" xsl:use-attribute-sets="table.number.cell">
|
||||
<fo:block xsl:use-attribute-sets="table.number.block">
|
||||
Table <xsl:value-of select="count(preceding-sibling::table) + 1"/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
-->
|
||||
</fo:table-footer>
|
||||
<!-- Process any tbody/tr or tr records -->
|
||||
<fo:table-body>
|
||||
<xsl:apply-templates select="tr" mode="html-table">
|
||||
<xsl:with-param name="spacerSpanColumns" select="$spacerSpanColumns"/>
|
||||
</xsl:apply-templates>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template match="tr[th]" mode="html-table">
|
||||
<xsl:comment> ::: Subheading row ::: </xsl:comment>
|
||||
<!-- Changed from table.body.row (a bug!) -->
|
||||
<fo:table-row xsl:use-attribute-sets="table.subheading.row">
|
||||
<xsl:apply-templates select="th|td" mode="html-table"/>
|
||||
</fo:table-row>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="tr[last()]" mode="html-table">
|
||||
<xsl:param name="spacerSpanColumns">1</xsl:param>
|
||||
<xsl:variable name="nColumns" select="count(th|td) + sum(th/@colspan|td/@colspan) - count(th/@colspan|td/@colspan)"/>
|
||||
<!-- Format the table row -->
|
||||
<xsl:comment> ::: Table body row <xsl:value-of select="position()"/> (<xsl:value-of select="$nColumns"/> columns) ::: </xsl:comment>
|
||||
<fo:table-row xsl:use-attribute-sets="table.body.row">
|
||||
<xsl:apply-templates select="th|td" mode="html-table"/>
|
||||
</fo:table-row>
|
||||
<!-- Add a spacer/border row: last row rule -->
|
||||
<xsl:comment> ::: Table row spacer for last row ::: </xsl:comment>
|
||||
<fo:table-row keep-with-previous="always">
|
||||
<fo:table-cell padding-after="3pt" number-columns-spanned="{$spacerSpanColumns}">
|
||||
<fo:block line-height="1pt">
|
||||
<xsl:comment> Ending border (solid rule) </xsl:comment>
|
||||
<fo:leader xsl:use-attribute-sets="table.body.lastrule"/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="tr" mode="html-table">
|
||||
<xsl:param name="spacerSpanColumns">1</xsl:param>
|
||||
<xsl:param name="nextRow" select="following-sibling::tr[1]"/>
|
||||
<xsl:variable name="nColumns" select="count($nextRow/th | $nextRow/td)
|
||||
+ sum($nextRow/th/@colspan |$nextRow/td/@colspan)
|
||||
- count($nextRow/th/@colspan | $nextRow/td/@colspan)"/>
|
||||
<!-- Table body rows work as follows:
|
||||
- If the current row is not followed by a 'subheading' row,
|
||||
add a bottom border
|
||||
- If the current row is also the last row, add a
|
||||
'final' bottom border, otherwise a 'normal' bottom border
|
||||
- Otherwise, do not add a bottom border
|
||||
- Process the row by building table cells one at a time
|
||||
-->
|
||||
<!-- Format the table row -->
|
||||
<xsl:comment> ::: Table body row <xsl:value-of select="position()"/> (<xsl:value-of select="$nColumns"/> columns) ::: </xsl:comment>
|
||||
<fo:table-row xsl:use-attribute-sets="table.body.row">
|
||||
<xsl:apply-templates select="th|td" mode="html-table"/>
|
||||
</fo:table-row>
|
||||
<!-- Add in a spacer/border row -->
|
||||
<xsl:comment> ::: Table row spacer for row <xsl:value-of select="position()"/> ::: </xsl:comment>
|
||||
<fo:table-row keep-with-previous="always">
|
||||
<fo:table-cell padding-after="3pt" number-columns-spanned="{$nColumns}">
|
||||
<fo:block line-height="1pt">
|
||||
<xsl:choose>
|
||||
<!-- If next row contains a th; no border, 2pt padding, 1pt white rule -->
|
||||
<xsl:when test="following-sibling::tr[1]/th">
|
||||
<xsl:comment> Spacer only </xsl:comment>
|
||||
<fo:leader xsl:use-attribute-sets="table.body.norule"/>
|
||||
</xsl:when>
|
||||
<!-- If a row follows; regular border -->
|
||||
<xsl:when test="following-sibling::tr[1]">
|
||||
<xsl:comment> Regular border (rule) </xsl:comment>
|
||||
<fo:leader xsl:use-attribute-sets="table.body.rule"/>
|
||||
</xsl:when>
|
||||
<!-- Last row border -->
|
||||
<xsl:otherwise>
|
||||
<xsl:comment> Ending border (rule) </xsl:comment>
|
||||
<fo:leader xsl:use-attribute-sets="table.body.lastrule"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="th" mode="html-table">
|
||||
<xsl:comment> : Table subheading cell : </xsl:comment>
|
||||
<fo:table-cell xsl:use-attribute-sets="table.subheading.cell">
|
||||
<xsl:apply-templates select="@colspan|@rowspan|@align" mode="html-table"/>
|
||||
<fo:block xsl:use-attribute-sets="table.subheading.block">
|
||||
<xsl:apply-templates/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="td" mode="html-table">
|
||||
<xsl:comment> : Table body cell <xsl:value-of select="position()"/> : </xsl:comment>
|
||||
<fo:table-cell xsl:use-attribute-sets="table.body.cell">
|
||||
<xsl:apply-templates select="@colspan|@rowspan|@align" mode="html-table"/>
|
||||
<xsl:apply-templates select="*" mode="table"/>
|
||||
<fo:block xsl:use-attribute-sets="table.body.block">
|
||||
<xsl:apply-templates/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@align" mode="html-table">
|
||||
<xsl:attribute name="text-align"><xsl:value-of select="."/></xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@colspan" mode="html-table">
|
||||
<xsl:attribute name="number-columns-spanned"><xsl:value-of select="number(.)"/></xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="@rowspan" mode="html-table">
|
||||
<xsl:attribute name="number-rows-spanned"><xsl:value-of select="number(.)"/></xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<!-- HTML tables generation with THEAD and TBODY -->
|
||||
|
||||
|
||||
|
||||
<xsl:template match="table" name="find-max-columns">
|
||||
<!-- Before we do anything, we need to scan the table to find the maximum span -->
|
||||
@ -405,4 +614,6 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
<xsl:attribute name="number-rows-spanned"><xsl:value-of select="number(.) * 2 - 1"/></xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
@ -1,27 +1,21 @@
|
||||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
|
||||
<!-- These attribute-sets are treated as 'styles,'
|
||||
and are referenced in the templates below -->
|
||||
|
||||
<xsl:attribute-set name="toc.cell">
|
||||
<xsl:attribute name="display-align">after</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="toc.base.style">
|
||||
<xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
|
||||
<xsl:attribute name="line-height">16pt</xsl:attribute>
|
||||
<xsl:attribute name="text-align-last">start</xsl:attribute>
|
||||
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="toc.leader.style">
|
||||
<xsl:attribute name="leader-pattern">dots</xsl:attribute>
|
||||
<xsl:attribute name="leader-pattern-width">5pt</xsl:attribute>
|
||||
<xsl:attribute name="color"><xsl:value-of select="$colorDarkGray"/></xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="toc.number.style">
|
||||
<xsl:attribute name="font-size">9.5pt</xsl:attribute>
|
||||
<xsl:attribute name="text-align">end</xsl:attribute>
|
||||
@ -29,31 +23,25 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
<xsl:attribute name="line-height">16pt</xsl:attribute>
|
||||
<xsl:attribute name="end-indent">6pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="toc.h1.style" use-attribute-sets="toc.base.style">
|
||||
<xsl:attribute name="font-size">12pt</xsl:attribute>
|
||||
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
||||
<xsl:attribute name="space-before">18pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="toc.h2.style" use-attribute-sets="toc.base.style">
|
||||
<xsl:attribute name="font-size">9.5pt</xsl:attribute>
|
||||
<xsl:attribute name="space-before">15pt</xsl:attribute>
|
||||
<xsl:attribute name="space-before">3pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="toc.h3.style" use-attribute-sets="toc.base.style">
|
||||
<xsl:attribute name="font-size">9.5pt</xsl:attribute>
|
||||
<xsl:attribute name="space-before">4pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="toc.h4.style" use-attribute-sets="toc.base.style">
|
||||
<xsl:attribute name="font-size">9.5pt</xsl:attribute>
|
||||
<xsl:attribute name="space-before">4pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Templates for handling the TOC -->
|
||||
|
||||
<xsl:template name="fo-toc">
|
||||
<fo:page-sequence master-reference="toc" initial-page-number="1" format="i">
|
||||
<!-- Render the header and footer -->
|
||||
@ -63,11 +51,10 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
<xsl:call-template name="body-footer">
|
||||
<xsl:with-param name="footerText" select="translate($footerText, $lc, $uc)"/>
|
||||
</xsl:call-template>
|
||||
|
||||
<fo:flow flow-name="xsl-region-body">
|
||||
<!-- Render the chapter heading -->
|
||||
<xsl:call-template name="body-chapter-heading">
|
||||
<xsl:with-param name="chapterNumber"></xsl:with-param>
|
||||
<xsl:with-param name="chapterNumber"/>
|
||||
<xsl:with-param name="chapter">Table of Contents</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<fo:table layout="fixed">
|
||||
@ -82,8 +69,6 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</fo:flow>
|
||||
</fo:page-sequence>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="project/body/menu" mode="toc">
|
||||
<fo:table-row keep-with-next="always">
|
||||
<fo:table-cell xsl:use-attribute-sets="toc.cell">
|
||||
@ -112,9 +97,8 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</xsl:choose>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<xsl:apply-templates mode="toc" />
|
||||
<xsl:apply-templates mode="toc"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="project/body/menu/item" mode="toc">
|
||||
<fo:table-row keep-with-next="always">
|
||||
<fo:table-cell xsl:use-attribute-sets="toc.cell">
|
||||
@ -143,12 +127,11 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</xsl:choose>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<xsl:apply-templates mode="toc" />
|
||||
<xsl:apply-templates mode="toc"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="project/body/menu/item/item" mode="toc">
|
||||
<fo:table-row>
|
||||
<fo:table-cell />
|
||||
<fo:table-cell/>
|
||||
<fo:table-cell xsl:use-attribute-sets="toc.cell">
|
||||
<fo:block xsl:use-attribute-sets="toc.number.style">
|
||||
<xsl:number count="menu"/>.<xsl:number count="menu/item"/>.<xsl:number count="menu/item/item"/>
|
||||
@ -175,13 +158,12 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</xsl:choose>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<xsl:apply-templates mode="toc" />
|
||||
<xsl:apply-templates mode="toc"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="project/body/menu/item/item/item" mode="toc">
|
||||
<fo:table-row>
|
||||
<fo:table-cell />
|
||||
<fo:table-cell />
|
||||
<fo:table-cell/>
|
||||
<fo:table-cell/>
|
||||
<fo:table-cell xsl:use-attribute-sets="toc.cell">
|
||||
<fo:block xsl:use-attribute-sets="toc.number.style">
|
||||
<xsl:number count="menu"/>.<xsl:number count="menu/item"/>.<xsl:number count="menu/item/item"/>.<xsl:number count="menu/item/item/item"/>
|
||||
@ -208,9 +190,6 @@ xmlns:fo="http://www.w3.org/1999/XSL/Format" version='1.0'>
|
||||
</xsl:choose>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<xsl:apply-templates mode="toc" />
|
||||
<xsl:apply-templates mode="toc"/>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
|
||||
|
||||
@ -1,15 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:svg="http://www.w3.org/TR/2001/REC-SVG-20010904" version='1.0'>
|
||||
|
||||
<xsl:include href="fo-layouts.xslt" />
|
||||
<xsl:include href="fo-cover.xslt" />
|
||||
<xsl:include href="fo-toc.xslt" />
|
||||
<xsl:include href="fo-body.xslt" />
|
||||
<xsl:include href="fo-tables.xslt" />
|
||||
<xsl:include href="fo-table-column-widths.xslt" />
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/TR/2001/REC-SVG-20010904" version="1.0">
|
||||
<xsl:include href="fo-layouts.xslt"/>
|
||||
<xsl:include href="fo-cover.xslt"/>
|
||||
<xsl:include href="fo-toc.xslt"/>
|
||||
<xsl:include href="fo-body.xslt"/>
|
||||
<xsl:include href="fo-tables.xslt"/>
|
||||
<xsl:include href="fo-table-column-widths.xslt"/>
|
||||
<xsl:param name="basePath">.</xsl:param>
|
||||
<xsl:param name="paperType">US</xsl:param>
|
||||
<xsl:param name="companyName">The Jakarta Project</xsl:param>
|
||||
@ -24,7 +20,7 @@
|
||||
<xsl:param name="coverType">Project Documentation</xsl:param>
|
||||
<xsl:param name="coverVersion">1.0</xsl:param>
|
||||
<xsl:param name="coverDate">January 1, 1901</xsl:param>
|
||||
<xsl:param name="debug"></xsl:param>
|
||||
<xsl:param name="debug">false</xsl:param>
|
||||
<!-- These next two variables are used in cheap-and-cheerful case conversions -->
|
||||
<xsl:variable name="lc">abcdefghijklmnopqrstuvwxyz</xsl:variable>
|
||||
<xsl:variable name="uc">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
|
||||
@ -37,17 +33,9 @@
|
||||
<xsl:variable name="colorDarkGray">#454545</xsl:variable>
|
||||
<xsl:variable name="colorMediumGray">#A9A9A9</xsl:variable>
|
||||
<xsl:variable name="colorLightGray">#D3D3D3</xsl:variable>
|
||||
<!--
|
||||
<xsl:variable name="colorWarmGrey11">#504b42</xsl:variable>
|
||||
-->
|
||||
<!-- <xsl:variable name="colorWarmGrey11">#504b42</xsl:variable> -->
|
||||
<xsl:variable name="colorWarmGrey11">#4b4542</xsl:variable>
|
||||
|
||||
<xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>
|
||||
|
||||
<!--
|
||||
<xsl:param name="debug">true</xsl:param>
|
||||
-->
|
||||
|
||||
<!-- Error style -->
|
||||
<xsl:attribute-set name="error.block" use-attribute-sets="base.block">
|
||||
<xsl:attribute name="font-size">8pt</xsl:attribute>
|
||||
@ -60,58 +48,52 @@
|
||||
<xsl:attribute name="start-indent">inherited-property-value(start-indent) + 2.5em</xsl:attribute>
|
||||
<xsl:attribute name="end-indent">inherited-property-value(end-indent) + 3em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
|
||||
<!-- Templates -->
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="project" />
|
||||
<xsl:apply-templates select="project"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="project">
|
||||
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
|
||||
<xsl:call-template name="fo-layouts" />
|
||||
<xsl:apply-templates />
|
||||
<xsl:call-template name="fo-layouts"/>
|
||||
<xsl:apply-templates/>
|
||||
</fo:root>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="project/body">
|
||||
<!-- Custom cover pages will be included in a future version -->
|
||||
<xsl:call-template name="fo-cover" />
|
||||
<!--
|
||||
<xsl:call-template name="fo-cover-inside" />
|
||||
-->
|
||||
<xsl:call-template name="fo-toc" />
|
||||
<xsl:apply-templates />
|
||||
<xsl:call-template name="fo-cover"/>
|
||||
<!-- <xsl:call-template name="fo-cover-inside" /> -->
|
||||
<xsl:call-template name="fo-toc"/>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="project/body/menu">
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="project/body/menu/item">
|
||||
<!-- Renders the xml xdoc document -->
|
||||
<xsl:call-template name="render-xdoc">
|
||||
<xsl:with-param name="chapterNumber"><xsl:number count="menu" />.<xsl:number count="menu/item" /></xsl:with-param>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:number count="menu"/>.<xsl:number count="menu/item"/>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="project/body/menu/item/item">
|
||||
<!-- Renders the xml xdoc document -->
|
||||
<xsl:call-template name="render-xdoc">
|
||||
<xsl:with-param name="chapterNumber"><xsl:number count="menu" />.<xsl:number count="menu/item" />.<xsl:number count="menu/item/item" /></xsl:with-param>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:number count="menu"/>.<xsl:number count="menu/item"/>.<xsl:number count="menu/item/item"/>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<xsl:apply-templates />
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="project/body/menu/item/item/item">
|
||||
<!-- Renders the xml xdoc document -->
|
||||
<xsl:call-template name="render-xdoc">
|
||||
<xsl:with-param name="chapterNumber"><xsl:number count="menu"/>.<xsl:number count="menu/item"/>.<xsl:number count="menu/item/item"/>.<xsl:number count="menu/item/item/item"/></xsl:with-param>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:number count="menu"/>.<xsl:number count="menu/item"/>.<xsl:number count="menu/item/item"/>.<xsl:number count="menu/item/item/item"/>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="render-xdoc">
|
||||
<xsl:param name="chapterNumber">Foo</xsl:param>
|
||||
<!-- Set the page number to start at. Normally this is 'auto'
|
||||
@ -134,13 +116,8 @@
|
||||
<xsl:variable name="documentPath" select="concat($basePath, $documentName, '.xml')"/>
|
||||
<xsl:if test="normalize-space(@href)">
|
||||
<xsl:if test="$debug = 'true'">
|
||||
<xsl:message>
|
||||
Href = <xsl:value-of select="$href"/></xsl:message>
|
||||
<xsl:message>
|
||||
Doc Name = <xsl:value-of select="$documentName"/></xsl:message>
|
||||
<xsl:message>
|
||||
Doc Path = <xsl:value-of select="$documentPath"/></xsl:message>
|
||||
<xsl:message>Creating XSL:FO for <xsl:value-of select="$documentPath"/></xsl:message>
|
||||
<xsl:message>Creating XSL:FO for <xsl:value-of select="$documentPath"/>
|
||||
</xsl:message>
|
||||
</xsl:if>
|
||||
<fo:page-sequence master-reference="body" initial-page-number="{$pageStart}">
|
||||
<!-- Render the header and footer -->
|
||||
@ -153,17 +130,30 @@ Doc Path = <xsl:value-of select="$documentPath"/></xsl:message>
|
||||
<fo:flow flow-name="xsl-region-body">
|
||||
<!-- Render the chapter heading -->
|
||||
<xsl:call-template name="body-chapter-heading">
|
||||
<xsl:with-param name="chapterNumber"><xsl:value-of select="$chapterNumber"/></xsl:with-param>
|
||||
<xsl:with-param name="chapter"><xsl:value-of select="@name" /></xsl:with-param>
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="chapter">
|
||||
<xsl:value-of select="@name"/>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
<!-- Render the associated xdoc -->
|
||||
<fo:block id="{@href}{generate-id()}">
|
||||
<xsl:apply-templates select="document($documentPath)/document/body" />
|
||||
<xsl:if test="not(starts-with($href, 'http'))">
|
||||
<xsl:apply-templates select="document($documentPath)/document/body">
|
||||
<xsl:with-param name="chapterNumber">
|
||||
<xsl:value-of select="$chapterNumber"/>
|
||||
</xsl:with-param>
|
||||
</xsl:apply-templates>
|
||||
</xsl:if>
|
||||
<xsl:if test="starts-with($href, 'http')">
|
||||
<fo:basic-link external-destination="{@href}">
|
||||
<fo:inline xsl:use-attribute-sets="href"><xsl:value-of select="$href"/></fo:inline>
|
||||
</fo:basic-link>
|
||||
</xsl:if>
|
||||
</fo:block>
|
||||
</fo:flow>
|
||||
</fo:page-sequence>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user