Question

I am using the maven docbook plugin (com.agilejava.docbkx), and I am using a custom xsl file to override some properties, and it looks like:

<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:attribute-set name="section.title.properties">
    <xsl:attribute name="font-family">Times</xsl:attribute>
  </xsl:attribute-set>
</xsl:stylesheet>

And I when I run the maven plugin, I get the following error

Embedded error: org.xml.sax.SAXParseException: Content is not allowed in prolog.

I'm running on windows and I have tried creating the file in Notepad, Notepad++, Eclipse and Cygwin all with the error. Does anyone know why?

Was it helpful?

Solution

Once I imported the main docbook stylesheet:

<xsl:import href="urn:docbkx:stylesheet"/>

Everything worked fine.

urn:docbkx:stylesheet can be considered as a symbolic link. What urn:docbkx:stylesheet actually will import depends on what customization (html, xhtml, etc.) you specify in your pom.xml. If you want to use xhtml/chunk.xsl customization then first specify the configuration <xhtmlCustomization> in the pom.xml. Then specify it in your XSL by,

<xsl:import href="urn:docbkx:stylesheet/chunk.xsl"/> 

In this case, the plugin will pick up the chunk.xsl sheet of xhtml stylesheets. Further details, and the complete configurations needed are explained in the How to Use docbkx-tools as Maven DocBook plugin blog post.

OTHER TIPS

Check your stylesheet for any characters (including spaces) before the opening tag at the start of the document:

<?xml ...

This is called the xml prolog which is recommended, but not required by W3C. (Another solution is to delete it completely).

Also don't forget to check the other XML files in your build (perhaps it's the Maven POM file that has the problem....)

If you've copied and pasted from the XML opened up in a web browser then you've probably done what I've done, which is to copy and paste the + and - widgets for expanding and contracting the xml snippets.

This puts loads of "-" and "+" characters in your copy and fails the validator.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top