"missing cover" when creating Kindle file from epub
Oxygen general issues.
-
- Posts: 31
- Joined: Sun Jun 14, 2009 4:25 pm
"missing cover" when creating Kindle file from epub
I'm using an epub generated from a Docbook transformed via ANT in Oxygen to create a .mobi file for the Amazon Kindle (using Kindle Previewer).
It keeps giving me a "missing cover" warning, which is displayed over the cover image.
The Kindle Previewer documentation says that the cover should be included this way:
Define covers in the OPF file using the following tags:
<metadata>
...
<meta name="cover" content="my-cover-image" >
...
</metadata> ... <manifest>
...
<item href="MyCoverImage.jpg" id="my-cover-image" media-type="image/jpeg" >
...
</manifest>
But I'm having trouble figuring out how to insert that using Oxygen's Archive Browser. I think I would probably have to insert that file in more than just the manifest folder. Also would it conflict with the "cover.jpg" file that's already in the ePub?
Any suggestions?
thanks!
DC Denison
It keeps giving me a "missing cover" warning, which is displayed over the cover image.
The Kindle Previewer documentation says that the cover should be included this way:
Define covers in the OPF file using the following tags:
<metadata>
...
<meta name="cover" content="my-cover-image" >
...
</metadata> ... <manifest>
...
<item href="MyCoverImage.jpg" id="my-cover-image" media-type="image/jpeg" >
...
</manifest>
But I'm having trouble figuring out how to insert that using Oxygen's Archive Browser. I think I would probably have to insert that file in more than just the manifest folder. Also would it conflict with the "cover.jpg" file that's already in the ePub?
Any suggestions?
thanks!
DC Denison
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: "missing cover" when creating Kindle file from epub
Hi,
You could open the resulting EPUB in the Archive Browser and manually edit the content.opf file to make these modifications. But I believe this is not the proper solution, because you will eventually generate the EPUB again from the DocBook source document and you will have to make the same manual modifications again.
For DocBook 4 if you need all generated EPUBs to have the cover specified this way, it's probably a better solution to customize the DocBook to EPUB stylesheets to include this modification in the generated output.
For DocBook 5 you can already specify the cover information in the source document (book/info/cover):
Regards,
Adrian
You could open the resulting EPUB in the Archive Browser and manually edit the content.opf file to make these modifications. But I believe this is not the proper solution, because you will eventually generate the EPUB again from the DocBook source document and you will have to make the same manual modifications again.
For DocBook 4 if you need all generated EPUBs to have the cover specified this way, it's probably a better solution to customize the DocBook to EPUB stylesheets to include this modification in the generated output.
For DocBook 5 you can already specify the cover information in the source document (book/info/cover):
Code: Select all
<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>
<address>
<city>City</city>
<street>Street</street>
<postcode>000000</postcode>
<country>Country</country>
</address>
<email>user@example.com</email>
</author>
<cover>
<mediaobject>
<imageobject>
<imagedata fileref="cover.jpg"/>
</imageobject>
</mediaobject>
</cover>
</info>
...
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 31
- Joined: Sun Jun 14, 2009 4:25 pm
Re: "missing cover" when creating Kindle file from epub
Hi, Jason Zech just figured it out:
In the <meta name="cover". you need to remove the namespace that Oxygen puts in there. For some reason that breaks the conversion. Go into your OPF and change your meta tag to:
<meta name="cover" content="cover-image"/>
In the <meta name="cover". you need to remove the namespace that Oxygen puts in there. For some reason that breaks the conversion. Go into your OPF and change your meta tag to:
<meta name="cover" content="cover-image"/>
-
- Posts: 9421
- Joined: Fri Jul 09, 2004 5:18 pm
Re: "missing cover" when creating Kindle file from epub
Hi,
Thanks for letting us know.
And we'll try to fix this issue in the next version of Oxygen.
As a workaround, if you open the build file:
OXYGEN_INSTALL_DIR/frameworks/docbook/xsl/epub/bin/build.xml
before this comment:
You could add this line:
Regards,
Radu
Thanks for letting us know.
And we'll try to fix this issue in the next version of Oxygen.
As a workaround, if you open the build file:
OXYGEN_INSTALL_DIR/frameworks/docbook/xsl/epub/bin/build.xml
before this comment:
Code: Select all
<!-- Remove old images from content.opf. -->
Code: Select all
<replaceregexp byline="false" file="${outputDir}/content.opf" match="<!DOCTYPE package((.|\s)*?)>" replace=""/>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 37
- Joined: Fri May 20, 2011 6:07 pm
Re: "missing cover" when creating Kindle file from epub
Hi Radu. Jason Zech here.
I see how your workaround would be effective, but since most of my projects involve a number of people on a number of remote computers over SVN, can you suggest a workaround that doesn't involve customizing the local build.xml file on every computer? Is there an XSL customization I could use to get rid of the namespace declaration in the meta tag? I'm already working with a customization layer, so that would be a preferable solution.
I've isolated the appropriate template in the epub xsl file docbook.xsl, but I can't seem to figure out how to keep the xhtml namespace from showing up.
Below is the template.
Since the package element, metadata element, and meta element all have explicitly declared namespaces of OPF, it seems like the processor shouldn't be putting the xhtml namespace on the meta tag, but it does. Here is the result I get:
This is a little odd. Is there an XSL workaround you could suggest? I've tried phrasing that part of the template a bunch of different ways. Everything I try either has the xhtml namespace or results in invalid OPF code.
Thanks for the help.
I see how your workaround would be effective, but since most of my projects involve a number of people on a number of remote computers over SVN, can you suggest a workaround that doesn't involve customizing the local build.xml file on every computer? Is there an XSL customization I could use to get rid of the namespace declaration in the meta tag? I'm already working with a customization layer, so that would be a preferable solution.
I've isolated the appropriate template in the epub xsl file docbook.xsl, but I can't seem to figure out how to keep the xhtml namespace from showing up.
Below is the template.
Code: Select all
<xsl:template name="opf">
<xsl:variable name="package-identifier-id"><xsl:value-of select="concat(name(/*), 'id')"/></xsl:variable>
<xsl:variable name="doc.title">
<xsl:call-template name="get.doc.title" />
</xsl:variable>
<xsl:call-template name="write.chunk">
<xsl:with-param name="filename">
<xsl:value-of select="$epub.opf.filename" />
</xsl:with-param>
<xsl:with-param name="method" select="'xml'" />
<xsl:with-param name="encoding" select="'utf-8'" />
<xsl:with-param name="indent" select="'no'" />
<xsl:with-param name="quiet" select="$chunk.quietly" />
<xsl:with-param name="doctype-public" select="''"/> <!-- intentionally blank -->
<xsl:with-param name="doctype-system" select="''"/> <!-- intentionally blank -->
<xsl:with-param name="content">
<!-- PACKAGE ELEMENT IS OPF NAMESPACE -->
<xsl:element namespace="http://www.idpf.org/2007/opf" name="package">
<xsl:attribute name="version">2.0</xsl:attribute>
<xsl:attribute name="unique-identifier"> <xsl:value-of select="$package-identifier-id"/> </xsl:attribute>
<!-- METADATA ELEMENT IS OPF NAMESPACE -->
<xsl:element namespace="http://www.idpf.org/2007/opf" name="metadata">
<xsl:element name="dc:identifier">
<xsl:attribute name="id"><xsl:value-of select="$package-identifier-id"/></xsl:attribute>
<xsl:call-template name="package-identifier"/>
</xsl:element>
<xsl:element name="dc:title">
<xsl:value-of select="normalize-space($doc.title)"/>
</xsl:element>
<xsl:apply-templates select="/*/*[contains(name(.), 'info')]/*"
mode="opf.metadata"/>
<xsl:element name="dc:language">
<xsl:call-template name="l10n.language">
<xsl:with-param name="target" select="/*"/>
</xsl:call-template>
</xsl:element>
<xsl:if test="/*/*[d:cover or contains(name(.), 'info')]//d:mediaobject[@role='cover' or ancestor::d:cover]">
<!-- META COVER ELEMENT IS OPF NAMESPACE, BUT GETS OUTPUT WITH XHTML NAMESPACE, NEED NO NAMESPACE -->
<xsl:element namespace="http://www.idpf.org/2007/opf" name="meta">
<xsl:attribute name="name">cover</xsl:attribute>
<xsl:attribute name="content">
<xsl:value-of select="$epub.cover.image.id"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:element>
<xsl:call-template name="opf.manifest"/>
<xsl:call-template name="opf.spine"/>
<xsl:call-template name="opf.guide"/>
</xsl:element>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
Code: Select all
<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">_book</dc:identifier>
<dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">BOOK 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="LASTNAME, FIRSTNAME">FIRSTNAME MIDDLE LASTNAME</dc:creator>
<dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2013</dc:date>
<dc:rights xmlns:dc="http://purl.org/dc/elements/1.1/">Copyright © 2013 Holder</dc:rights>
<dc:language xmlns:dc="http://purl.org/dc/elements/1.1/">en</dc:language>
<!-- NEED TO GET RID OF XHTML NAMESPACE BELOW -->
<meta xmlns="http://www.w3.org/1999/xhtml" name="cover" content="cover-image"/>
</metadata>
...
Thanks for the help.
-
- Posts: 501
- Joined: Mon Feb 03, 2003 10:56 am
Re: "missing cover" when creating Kindle file from epub
Looks like the XSLT processor gets confused by the "meta" element (which is also declared in the XHTML vocabulary).
Try changing from:
to:
This worked well for me.
Best regards,
Dan
Try changing from:
Code: Select all
<xsl:element namespace="http://www.idpf.org/2007/opf" name="meta">
<xsl:attribute name="name">cover</xsl:attribute>
<xsl:attribute name="content">
<xsl:value-of select="$epub.cover.image.id"/>
</xsl:attribute>
</xsl:element>
Code: Select all
<opf:meta>
<xsl:attribute name="name">cover</xsl:attribute>
<xsl:attribute name="content">
<xsl:value-of select="$epub.cover.image.id"/>
</xsl:attribute>
</opf:meta>
Best regards,
Dan
-
- Posts: 37
- Joined: Fri May 20, 2011 6:07 pm
Re: "missing cover" when creating Kindle file from epub
Thank you for your help, Dan. Implementing your suggestion did fix the ambiguity, but it replaced the xhtml namespace in the meta tag with the OPF namespace, which still breaks the Kindle conversion.
However, I was able to get it to work by changing the xsl:element tag for meta to <opf:meta> (as you suggested) and by ALSO changing the xsl:element tag for metadata to <opf:metadata>. This puts the OPF namespace declaration on the metadata tag and removes it from the meta tag.
I've run it through Kindlegen, and the conversion works fine now. Thanks again for your help.
However, I was able to get it to work by changing the xsl:element tag for meta to <opf:meta> (as you suggested) and by ALSO changing the xsl:element tag for metadata to <opf:metadata>. This puts the OPF namespace declaration on the metadata tag and removes it from the meta tag.
I've run it through Kindlegen, and the conversion works fine now. Thanks again for your help.
-
- Posts: 9421
- Joined: Fri Jul 09, 2004 5:18 pm
Re: "missing cover" when creating Kindle file from epub
Hi Jason,
Just to explain a little bit the original problem:
When the Docbook XSLs generate the OPF file, the OPF contains the following DOCTYPE:
This is quite incorrect because OPF is not related at all with XHTML.
But it also cannot be changed from the XSLs because Docbook uses XSLT 1.0 when chunking the XHTML output and it needs the DOCTYPE set like this for the XHTML generated files.
After this, we have two XSLs which get applied on the generated OPF in order to properly correct paths to images. But because of the DOCTYPE, the XSLT processor considers that the OPF <meta> element is actually an XHTML element and adds a namespace to it when generating the final OPF file.
We will probably have this corrected in 14.2 in the Spring of 2013.
Regards,
Radu
Just to explain a little bit the original problem:
When the Docbook XSLs generate the OPF file, the OPF contains the following DOCTYPE:
Code: Select all
<!DOCTYPE package
PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
......
But it also cannot be changed from the XSLs because Docbook uses XSLT 1.0 when chunking the XHTML output and it needs the DOCTYPE set like this for the XHTML generated files.
After this, we have two XSLs which get applied on the generated OPF in order to properly correct paths to images. But because of the DOCTYPE, the XSLT processor considers that the OPF <meta> element is actually an XHTML element and adds a namespace to it when generating the final OPF file.
We will probably have this corrected in 14.2 in the Spring of 2013.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service