I create ePub output from the attached DocBook 5 XML file using DocBook XSL 1.76.1. The output ePub file is not valid because the files content.opf, toc.ncx and container.xml contain a wrong DOCTYPE declaration. The content.opf.file starts with:
<!DOCTYPE package
PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
and the toc.ncx file starts with:
<!DOCTYPE ncx
PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
and container.xml starts with:
<!DOCTYPE container
PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
This is wrong because they are not XHTML files.
I get the same wrong DOCTYPE declaration with both the Saxon 6.5 transformer and the Xalan one. I used the following command lines for creating the output ePub file:
- Saxon 6.5:
java -cp saxon.jar com.icl.saxon.StyleSheet -o output.html docbook5.xml docbook1.76.1/xsl/epub/docbook.xsl
- Xalan:
java -cp xalan.jar org.apache.xalan.xslt.Process -out output.html -in docbook5.xml -xsl docbook1.76.1/xsl/epub/docbook.xsl
I tried both the Saxon command line and the Xalan one with both the NS (namespace-stripping) version of the DocBook XSL 1.76.1 stylesheets and the simple version (no namespace stripping). The wrong DOCTYPE declarations inserted at the beginning of the files are the same in all cases.
I just ran into this today. I believe the correct resolution is to make the following change in these files: xhtml-1_1/docbook.xsl, xhtml-1_1/maketoc.xsl, and xhtml-1_1/profile-docbook.xsl:
Remove the doctype-public and doctype-system attributes from the xsl:output line in each of the files listed above.
When I did this, the resulting epub files validate correctly against epubcheck.
Unfortunately this is not solution as it would break XHTML output -- you usually want !DOCTYPE there although it's mostly useless.
Is there any reason you can't use EPUB3 stylesheets? They don't have this problem and generate output compatible with EPUB2 devices.
Right now, we have to build both. I have a distributor who won't accept epub3. When that changes, I'll move to epub3 (we already use epub3 when we build .mobi files).