I'm trying to generate a mod spec with pdf generation. The way I have it be generated is using a contents.xml file which looks like this...
<?xml version="1.0" encoding="UTF-8"?>
<article xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://docbook.org/ns/docbook http://schema.5d.ca/docbook/docbook.xsd
http://www.w3.org/2001/XInclude http://schema.5d.ca/docbook/XInclude.xsd">
<title>Mod Spec</title>
<?dbfo-need height="8in" space-before="3em" ?>
<xi:include href="first.xml"/>
<section>
<title>View Stuff</title>
<xi:include href="./stuff/panel.xml"/>
</section>
<section>
<title>Nav things</title>
<xi:include href="./things/about.xml"/>
<xi:include href="./things/control.xml"/>
<xi:include href="./things/launch.xml"/>
</section>
...(more sections with includes)
</article>
Now I also have a stylesheet that sets header, footer, and table style stuff before the above xml is sent off for XSL-FO, and this stylesheet will need to add the page breaks.
So my question is: How do do I add a page break between all my sperate modspecs in contents.xml?
EDIT http://www.sagehill.net/docbookxsl/PageBreaking.html States I should add this to my XSLT:
<xsl:template match="processing-instruction('hard-pagebreak')">
<fo:block break-after='page'/>
</xsl:template>
So that it picks up <?hard-pagebreak?>
in the .xml files. I would like to keep the solution as compact as possible, so how do I edit my stylesheet so that a first pass will add the <?hard-pagebreak?>
after each <xi:include>
followed by the template given my sagehill?
This stylesheet:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://www.w3.org/2001/XInclude">
<xsl:template match="@*|node()" name="identity">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="xi:include">
<xsl:call-template name="identity"/>
<xsl:processing-instruction name="hard-pagebreak"/>
</xsl:template>
</xsl:stylesheet>
Output:
<article xsi:schemaLocation=
"http://docbook.org/ns/docbook http://schema.5d.ca/docbook/docbook.xsd
http://www.w3.org/2001/XInclude http://schema.5d.ca/docbook/XInclude.xsd"
xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude">
<title>Mod Spec</title>
<?dbfo-need height="8in" space-before="3em" ?>
<xi:include href="first.xml"></xi:include>
<?hard-pagebreak?>
<section>
<title>View Stuff</title>
<xi:include href="./stuff/panel.xml"></xi:include>
<?hard-pagebreak?>
</section>
<section>
<title>Nav things</title>
<xi:include href="./things/about.xml"></xi:include>
<?hard-pagebreak?>
<xi:include href="./things/control.xml"></xi:include>
<?hard-pagebreak?>
<xi:include href="./things/launch.xml"></xi:include>
<?hard-pagebreak?>
</section> ...(more sections with includes)
</article>
So, then you can add that template matching fictitious hard-pagebreak
processing instruction into the DocBook to FOP stylesheet