"Content not allowed in prolog"--what prolog???
Posted: Wed Sep 05, 2007 3:54 pm
I keep getting this "Content not allowed in prolog" error when attempting to transform a Docbook XML file into a PDF (using FO). I don't know what prolog it's talking about, but it's becoming extremely frustrating, especially when it hasn't been this difficult to decipher errors when transforming to HTML.
My Docbook XML file is as follows:
I admit I'm new to toying around with Docbook, but I've checked for well-formedness and validity without errors. I'm using the XML Schema for Docbook CR5.
My XSL stylesheet is as follows:
Obviously it's pretty sparse right now, but I was trying to get just this small bit done before I moved onto anything more complex. But, so far, I've had no luck, not even with this small bit.
I've tried with all XSL processors I can think of but I lean towards Saxon8 because I'm blindly leading towards the idea of XSLT 2.0 == better than 1.0. As a side thing it would be nice to know if (and why) this is untrue if I'm incorrect in this notion.
But most importantly, I would love to get the XSL-FO transform working.
My Docbook XML file is as follows:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xsl-fo.xsl"?>
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://docbook.org/ns/docbook file:/my/local/path/to/docbook.xsd">
<title><acronym>College Success Preparation</acronym> Program Booklet</title>
<xi:include href="program_background.xml" />
<xi:include href="statement_from_director.xml" />
<xi:include href="student_bios.xml" />
<xi:include href="photo_gallery.xml" />
<xi:include href="reflections_student_contributions.xml" />
<xi:include href="staff_bios.xml" />
</book>
My XSL stylesheet is as follows:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="2.0">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="default" page-width="8.5in" page-height="11in">
<fo:region-body />
<fo:region-before />
<fo:region-after />
</fo:simple-page-master>
<fo:simple-page-master master-name="biographies">
<fo:region-body />
<fo:region-before />
<fo:region-after />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="default">
<fo:flow flow-name="xsl-region-body" />
<fo:flow flow-name="xsl-region-before">
<fo:block font-size="1in">
<xsl:value-of select="title" />
</fo:block>
</fo:flow>
<fo:flow flow-name="xsl-region-after" />
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="simplelist">
<fo:block>
<xsl:apply-templates />
</fo:block>
</xsl:template>
<xsl:template match="member/person">
<fo:block background-color="#666666">
<xsl:apply-templates />
</fo:block>
</xsl:template>
<xsl:template match="member/person/personname">
<fo:block
font-family="'Bauhaus 93', 'Myriad Web', Myraid, 'Century Gothic', Arial, sans-serf"
font-weight="bold"
text-align="right">
<xsl:value-of select="firstname" />
<xsl:text> </xsl:text>
<xsl:value-of select="surname" />
</fo:block>
</xsl:template>
<xsl:template match="member/person/address">
<fo:block>
<fo:inline separator=", ">
<xsl:value-of select="city" />
<xsl:value-of select="state" />
</fo:inline>
<xsl:value-of select="country" />
</fo:block>
</xsl:template>
<xsl:template match="member/person/affiliation" />
<xsl:template match="member/person/personblurb" />
</xsl:stylesheet>
I've tried with all XSL processors I can think of but I lean towards Saxon8 because I'm blindly leading towards the idea of XSLT 2.0 == better than 1.0. As a side thing it would be nice to know if (and why) this is untrue if I'm incorrect in this notion.
But most importantly, I would love to get the XSL-FO transform working.