[oXygen-user] A Trivial Docbook to Epub Oxygen/Ant Transform doesn't produce valid epub files!

Radu Coravu radu_coravu at sync.ro
Wed Oct 5 03:47:18 CDT 2011


Hi Robert,

Basically the stylesheet used to obtain the OPF file from the Docbook 
content:

> OXYGEN_INSTALL_DIR/frameworks/docbook/xsl/epub/docbook.xsl

contains inside it constructs like:

> //d:book[d:bookinfo]|

These templates correctly matches Docbook 4 books (for which the 
information was added in "bookinfo" elements) but does not correctly 
match Docbook 5 books (where the information is inside "info" elements).

I will probably start a discussion about this with somebody on the 
Docbook side, the fix seems simple to me, additional XPath selectors 
need to be added to match "info" elements (in each place where 
"bookinfo" was used as a matching condition).

Regards,
Radu

Radu Coravu
<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


On 10/5/2011 5:33 AM, Robert Nagle wrote:
> Hi, I tried in XML Author to transform a small and simple docbook file
> using the included build.xml file.
>
> I used an example file already included with Oxygen. I added a chapter
> and removed the address element (for reasons explained below).
>
>
> ***********************************
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng"
> schematypens="http://relaxng.org/ns/structure/1.0"?>
> <book xmlns="http://docbook.org/ns/docbook"
>      xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
>      <info>
>          <title>Book Template Title</title>
>          <author>
>              <orgname>Organization Name</orgname>
>
>              <email>user at example.com</email>
>          </author>
>      </info>
>      <part>
>          <title>First Part</title>
>          <subtitle>Subtitle of First Part</subtitle>
>          <chapter>
>              <title>Chapter Title</title>
>              <subtitle>Subtitle of Chapter</subtitle>
>              <sect1>
>                  <title>Section1 Title</title>
>                  <subtitle>Subtitle of Section 1</subtitle>
>                  <para>Text hello this is robert</para>
>              </sect1>
>          </chapter>
>          <chapter>  <title>Second chapter</title>
>          <para>  This is the second chapter.</para>
>
>          </chapter>
>      </part>
> </book>
> **************************************
>
> I used the ant script to transform this small xml file  into epub. I
> did produce an epub file, but it did not validate with epubcheck.
>
> Here are the validation messages:
>
> SystemID: zip:file:/I:/My Documents/My
> Dropbox/xml/oxygen-mytest/out/dummy.epub!/content.opf
> Engine name: EpubCheck
> Severity: error
> Description: item with id 'd0e2' not found
> Start location: 1:0
>
> SystemID: I:\My Documents\My Dropbox\xml\oxygen-mytest\out\dummy.epub
> Engine name: EpubCheck
> Severity: warning
> Description: item (index.html) exists in the zip file, but is not
> declared in the OPF file
>
> SystemID: zip:file:/I:/My Documents/My
> Dropbox/xml/oxygen-mytest/out/dummy.epub!/toc.ncx
> Engine name: EpubCheck
> Severity: error
> Description: 'index.html': referenced resource exists, but not
> declared in the OPF file
> Start location: 1:0
>
> **********************
>
> Here is the content.opf file. I put marks where there were problems
>
> <?xml version="1.0" encoding="utf-8"?>
> <package xmlns="http://www.idpf.org/2007/opf" version="2.0"
> unique-identifier="bookid">
>      <metadata>
>          <dc:identifier xmlns:dc="http://purl.org/dc/elements/1.1/"
> id="bookid">_d0e2</dc:identifier>
>          <dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">Book
> Template Title</dc:title>
>          <dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/"
>              xmlns:opf="http://www.idpf.org/2007/opf" opf:file-as=""/>
>          <dc:language
> xmlns:dc="http://purl.org/dc/elements/1.1/">en</dc:language>
>      </metadata>
>      <manifest>
>          <item id="ncxtoc" media-type="application/x-dtbncx+xml" href="toc.ncx"/>
>          <item id="htmltoc" media-type="application/xhtml+xml"
> href="bk01-toc.html"/>
>          <item id="d0e11" href="pt01.html" media-type="application/xhtml+xml"/>
>          <item id="d0e16" href="ch01.html" media-type="application/xhtml+xml"/>
>          <item id="d0e28" href="ch02.html" media-type="application/xhtml+xml"/>
>      </manifest>
>      <spine toc="ncxtoc">
>          <itemref idref="htmltoc" linear="yes"/>
>          <itemref idref="d0e2"/>
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>          <itemref idref="d0e11"/>
>          <itemref idref="d0e16"/>
>          <itemref idref="d0e28"/>
>      </spine>
>      <guide>
>          <reference href="bk01-toc.html" type="toc" title="Table of Contents"/>
>                                       XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> NO INDEX.HTML reference
>      </guide>
> </package>
>
> ********************************************************************
>
> The ant log is below. Please note that I later  ran the db2epub.py
> script via command line with no customization layer using
> docbook-xsl-1.76.1 and produced an epub file validated by epubcheck.
> The index.html file was correctly referenced.
>
> A few other notes. First, db2epub.py did produce a kind of html output
> error with the address containing a single invalid p tag. I don't know
> what's going on with that, but that could be a docbook xsl bug.
>
> Second, I seem to recall that when my customization layer referenced
> the namespaced version of the epub docbook xsl that occasionally it
> produced extra references in content.opf. Keith Fahlgren basically
> said it was related to using the namespaced XSL when making epub
> transforms.
>
> I would appreciate any insight you can shed on this. Thanks. Robert
>
>
>
> Executing:
> "c:\program files (x86)\oxygen xml editor 13\jre/bin/java" -Xmx256m
> -classpath "C:\Program Files (x86)\Oxygen XML Editor
> 13/tools/ant/lib/ant-launcher.jar" "-Dant.home=C:\Program Files
> (x86)\Oxygen XML Editor 13/tools/ant"
> org.apache.tools.ant.launch.Launcher -lib "C:\Program Files
> (x86)\Oxygen XML Editor 13\classes" -lib "C:\Program Files
> (x86)\Oxygen XML Editor 13\lib\oxygen.jar" -lib "C:\Program Files
> (x86)\Oxygen XML Editor 13\lib\oxygenAuthor.jar" -lib "C:\Program
> Files (x86)\Oxygen XML Editor 13\lib\oxygenDeveloper.jar" -lib
> "C:\Program Files (x86)\Oxygen XML Editor 13\lib\oxygenEclipse.jar"
> -lib "C:\Program Files (x86)\Oxygen XML Editor
> 13\lib\oxygenAuthorEclipse.jar" -lib "C:\Program Files (x86)\Oxygen
> XML Editor 13\lib\oxygenDeveloperEclipse.jar" -lib "C:\Program Files
> (x86)\Oxygen XML Editor 13\lib\resolver.jar" -lib "C:\Program Files
> (x86)\Oxygen XML Editor 13\lib\xercesImpl.jar" -lib "C:\Program Files
> (x86)\Oxygen XML Editor 13\lib\saxon.jar" -lib "C:\Program Files
> (x86)\Oxygen XML Editor 13\lib\xml-apis-xpath.jar" -lib "C:\Program
> Files (x86)\Oxygen XML Editor 13\lib\xml-apis-ext.jar" -lib
> "C:\Program Files (x86)\Oxygen XML Editor 13\lib\log4j.jar" -f
> "C:\Program Files (x86)\Oxygen XML Editor
> 13\frameworks/docbook/xsl/epub/bin/build.xml"
> "-Dchunker.output.encoding=UTF-8" "-DoutputFile=I:\My Documents\My
> Dropbox\xml\oxygen-mytest/out/dummy.epub" "-DxmlFile=I:\My
> Documents\My Dropbox\xml\oxygen-mytest\dummy.xml"
>
> Buildfile: C:\Program Files (x86)\Oxygen XML Editor
> 13\frameworks\docbook\xsl\epub\bin\build.xml
>
> dist:
>     [delete] Deleting directory I:\My Documents\My Dropbox\xml\oxygen-mytest\out
>      [mkdir] Created dir: I:\My Documents\My Dropbox\xml\oxygen-mytest\out
>       [copy] Copying 1 file to I:\My Documents\My Dropbox\xml\oxygen-mytest\out
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\dummy.xml to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\xincluded-profiled.xml
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\profiling\profile.xsl
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\xincluded-profiled.xml to I:\My
> Documents\My Dropbox\xml\oxygen-mytest\out\dummy.xml
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\docbook.xsl
>       [xslt] Writing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out/bk01-toc.html for book
>       [xslt] Writing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out/ch01.html for chapter
>       [xslt] Writing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out/ch02.html for chapter
>       [xslt] Writing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out/pt01.html for part
>       [xslt] Writing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out/index.html for book
>       [xslt] Writing I:\My Documents\My Dropbox\xml\oxygen-mytest\out/toc.ncx
>       [xslt] Writing I:\My Documents\My Dropbox\xml\oxygen-mytest\out/content.opf
>       [xslt] Writing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out/META-INF/container.xml
>     [delete] Deleting: I:\My Documents\My Dropbox\xml\oxygen-mytest\out\dummy.xml
>     [delete] Deleting: I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\xincluded-profiled.xml
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\content.opf to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\temp\content.opf
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\removeImagesContentOpf.xsl
>       [copy] Copying 1 file to I:\My Documents\My Dropbox\xml\oxygen-mytest\out
>
> images:
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\bk01-toc.html to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\temp\bk01-toc.html
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\images.xsl
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\content.opf to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\temp\content.opf
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\addImagesContentOpf.xsl
>       [copy] Copying 1 file to I:\My Documents\My Dropbox\xml\oxygen-mytest\out
>
> images:
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\ch01.html to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\temp\ch01.html
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\images.xsl
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\content.opf to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\temp\content.opf
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\addImagesContentOpf.xsl
>       [copy] Copying 1 file to I:\My Documents\My Dropbox\xml\oxygen-mytest\out
>
> images:
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\ch02.html to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\temp\ch02.html
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\images.xsl
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\content.opf to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\temp\content.opf
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\addImagesContentOpf.xsl
>       [copy] Copying 1 file to I:\My Documents\My Dropbox\xml\oxygen-mytest\out
>
> images:
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\index.html to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\temp\index.html
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\images.xsl
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\content.opf to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\temp\content.opf
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\addImagesContentOpf.xsl
>       [copy] Copying 1 file to I:\My Documents\My Dropbox\xml\oxygen-mytest\out
>
> images:
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\pt01.html to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\temp\pt01.html
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\images.xsl
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\content.opf to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\temp\content.opf
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\addImagesContentOpf.xsl
>       [copy] Copying 1 file to I:\My Documents\My Dropbox\xml\oxygen-mytest\out
>       [copy] Copying 5 files to I:\My Documents\My Dropbox\xml\oxygen-mytest\out
>     [delete] Deleting directory I:\My Documents\My Dropbox\xml\oxygen-mytest\temp
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\toc.ncx to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\temp\toc.ncx
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\copy.xsl
>       [copy] Copying 1 file to I:\My Documents\My Dropbox\xml\oxygen-mytest\out
>       [xslt] Processing I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\META-INF\container.xml to I:\My
> Documents\My Dropbox\xml\oxygen-mytest\temp\container.xml
>       [xslt] Loading stylesheet C:\Program Files (x86)\Oxygen XML
> Editor 13\frameworks\docbook\xsl\epub\copy.xsl
>       [copy] Copying 1 file to I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\META-INF
>        [zip] Building zip: I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\dummy.epub
>        [zip] Updating zip: I:\My Documents\My
> Dropbox\xml\oxygen-mytest\out\dummy.epub
>
> BUILD SUCCESSFUL
> Total time: 3 seconds
>
> The process finished with exit code: 0



More information about the oXygen-user mailing list