#1136 epub: buggy content.opf causes crashes!

output: ePub
open-accepted
XSL (1066)
5
2011-08-28
2010-09-21
No

In the attached archive, the content.opf file has an incorrectly generated "spine". The ePub file was generated using the docbook.xsl file in Bug #3071521. (No patch was made to this file.)

This bug doesn't manifest itself with Adobe Digital Editions *BUT* causes unexpected behaviour with Apple iBooks and Stanza.

If you look in the myoutput/OEBPS/content.opf file in the archive, you will observe the following:

<spine toc="ncxtoc">
<itemref idref="htmltoc" linear="yes"/>
<itemref idref="id36130717"/>
<itemref idref="id36130701"/>

The idref=id36130701 corresponds to the pr01.html, the Preface file. This is the file you expect to follow bk01-toc.html, the Table of Contents file.

However, the preceding mysterious idref=id36130717 doesn't correspond to a file at all!

(All of the other idref's correspond to files.)

When you attempt to read through the Table of Contents to the Preface using Apple iBooks, it gets lost, shows a bunch of blank pages, and produces the infamous "the requested resource is missing" error. When you attempt to read through the Table of Contents to the Preface using Stanza, it crashes!

Please let me know if you need any more information.

Thanks.

Discussion

  • Oliver K. Smith

    Oliver K. Smith - 2010-09-23

    fix for content.opf bugs

     
  • Oliver K. Smith

    Oliver K. Smith - 2010-09-23

    I found a way to fix this problem.

    In the file epub/docbook.xsl, do the following:

    CHANGE:

    <xsl:template match="*" mode="opf.spine">
    <xsl:variable name="is.chunk">
    <xsl:call-template name="chunk">
    <xsl:with-param name="node" select="."/>
    </xsl:call-template>
    </xsl:variable>

    <xsl:if test="$is.chunk != 0">
    <xsl:element namespace="http://www.idpf.org/2007/opf" name="itemref">
    <xsl:attribute name="idref">
    <xsl:value-of select="generate-id(.)"/>
    </xsl:attribute>
    </xsl:element>
    <xsl:apply-templates select="*|.//d:refentry" mode="opf.spine"/>
    </xsl:if>
    </xsl:template>

    TO:

    <xsl:template match="*" mode="opf.spine">
    <xsl:variable name="is.chunk">
    <xsl:call-template name="chunk">
    <xsl:with-param name="node" select="."/>
    </xsl:call-template>
    </xsl:variable>

    <xsl:if test="$is.chunk != 0">
    <xsl:if test="local-name(.)!='book' and local-name(.)!='article'">
    <xsl:element namespace="http://www.idpf.org/2007/opf" name="itemref">
    <xsl:attribute name="idref">
    <xsl:value-of select="generate-id(.)"/>
    </xsl:attribute>
    </xsl:element>
    </xsl:if>
    <xsl:apply-templates select="*|.//d:refentry" mode="opf.spine"/>
    </xsl:if>
    </xsl:template>

    This fixes the problem. There is probably a better way to do this, but this works for now.

    Attached is a patch file which can be applied to the docbook.xsl file that was attached to bug #3071521.

    The patch file also includes the fix described in bug #3071937.

    Thanks.

     
  • Keith Fahlgren

    Keith Fahlgren - 2010-09-23

    Notes:

    * Please submit valid DocBook 4.5 or DocBook 5.0 files for testing. The attached needs a namespace declaration to be DocBook 5.0:
    <book xmlns="http://docbook.org/ns/docbook" version="5.0">
    * Be aware that these issues are only present in the -NS version of the stylesheets.
    * Please put new issues in the XSL Category.

     
  • Keith Fahlgren

    Keith Fahlgren - 2010-09-23
    • labels: 1168228 --> XSL
    • status: open --> open-accepted
     
  • Oliver K. Smith

    Oliver K. Smith - 2010-09-23

    I am attaching a new archive.

    I have validated the docbook file with relames from Sun's MSV website.

    Below is a revised version of my earlier message.

    The content.opf file has an incorrectly generated "spine". The ePub file was generated using the docbook.xsl file in Bug #3071521. (No patch was made to this file.)

    This bug doesn't manifest itself with Adobe Digital Editions *BUT* causes unexpected behaviour with Apple iBooks and Stanza.

    If you look in the myoutput/OEBPS/content.opf file in the archive, you will observe the following:

    <itemref idref="htmltoc" linear="yes"/>
    <itemref idref="id36061636"/>
    <itemref idref="id36116714"/>

    The idref=id36116714 corresponds to the pr01.html, the Preface file. This is the file you expect to follow bk01-toc.html, the Table of Contents file.

    However, the preceding mysterious idref=id36061636 doesn't correspond to a file at all!

    (All of the other idref's correspond to files.)

    When you attempt to read through the Table of Contents to the Preface using Apple iBooks, it gets lost, shows a bunch of blank pages, and produces the infamous "the requested resource is missing" error. When you attempt to read through the Table of Contents to the Preface using Stanza, it crashes!

    I hope this helps.

    Thanks.

     
  • Mauritz Jeanson

    Mauritz Jeanson - 2011-08-28
    • summary: buggy content.opf causes crashes! --> epub: buggy content.opf causes crashes!
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks