Page 1 of 1

Can't create PDF from book chunk with includes

Posted: Mon Dec 28, 2009 1:35 pm
by burbles
I have a Docbook 5 'book' chunk with includes to frontmatter and chapters, and can't generate a PDF of the whole book. I have been able to generate PDFs of each individual chapter with no problems. When I try to transform the 'book' using RenderX I get six errors (one for each chunk?) in the command line window: "Element include in namespace 'http://www.w3.org/2001/XInclude' encountered in book, but no template matches". I'm using Oxygen 11.1 and RenderX 4.17, and have a custom stylesheet as below.

The RenderX event log is:

Code: Select all

(document [system-id file:/C:/XML_datafiles/abacc_book.xml]
(validate
[error] Element 'fo:block' cannot be a child of 'fo:root'.
[error] Element 'fo:block' cannot be a child of 'fo:root'.
[error] Element 'fo:block' cannot be a child of 'fo:root'.
[error] Element 'fo:block' cannot be a child of 'fo:root'.
[error] Element 'fo:block' cannot be a child of 'fo:root'.
[error] Element 'fo:block' cannot be a child of 'fo:root'.
[error] Attribute 'color' cannot occur at element 'fo:block'.
[error] Attribute 'color' cannot occur at element 'fo:block'.
[error] Attribute 'color' cannot occur at element 'fo:block'.
[error] Attribute 'color' cannot occur at element 'fo:block'.
[error] Attribute 'color' cannot occur at element 'fo:block'.
[error] Attribute 'color' cannot occur at element 'fo:block'.
[validation total: 12 errors]
[error] com.renderx.xep.lib.FormatterException: Invalid XSL FO source 'file:/C:/XML_datafiles/abacc_book.xml': 12 errors found during validation
[error] javax.xml.transform.TransformerException: com.renderx.xep.lib.FormatterException: Invalid XSL FO source 'file:/C:/XML_datafiles/abacc_book.xml': 12 errors found during validation
[error] formatting failed
[error] javax.xml.transform.TransformerException: com.renderx.xep.lib.FormatterException: Invalid XSL FO source 'file:/C:/XML_datafiles/abacc_book.xml': 12 errors found during validation

Formatting failed.
My book chunk is:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="http://www.oasis-open.org/docbook/xml/5.0/rng/docbookxi.rng" type="xml"?>
<book xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
<xi:include href="halftitle.xml" />
<xi:include href="imprint.xml" />
<xi:include href="preface.xml" />
<xi:include href="abacc_chap1.xml" />
<xi:include href="abacc_chap2.xml" />
<xi:include href="abacc_chap3.xml" />
</book>
The custom stylesheet calls the DocBook stylesheet supplied with Oxygen:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:import
href="file:///c:/Program Files/Oxygen XML Editor 11/frameworks/docbook/xsl/fo/docbook.xsl" />
<xsl:template match="processing-instruction('lnbr')">
<fo:block />
</xsl:template>
<xsl:template match="processing-instruction('pgbr')">
<fo:block break-after="page" />
</xsl:template>
</xsl:stylesheet>
Thanks in advance for any help.
Dave

Re: Can't create PDF from book chunk with includes

Posted: Tue Dec 29, 2009 6:58 am
by burbles
I have found my answer after a bit of searching through other posts. I added to my customised stylesheet a template match, <xsl:template match="xi:include">:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xi="http://www.w3.org/2001/XInclude">
<xsl:import
href="file:///c:/Program Files/Oxygen XML Editor 11/frameworks/docbook/xsl/fo/docbook.xsl" />
<xsl:template match="xi:include">
<xsl:apply-templates select="document(@href)/*" />
</xsl:template>
<xsl:template match="processing-instruction('lnbr')">
<fo:block />
</xsl:template>
<xsl:template match="processing-instruction('pgbr')">
<fo:block break-after="page" />
</xsl:template>
</xsl:stylesheet>
This now brings in all the include files when creating the PDF.