OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Images do not extract to epub OPF manifest


Hi Dave,

The ANT build file for the Docbook to EPUB transformation:

OXYGEN_INSTALL_DIR/frameworks/docbook/xsl/epub/bin/build.xml

was created by us (Oxygen XML Editor) from the original Python scripts 
which were available to transform to EPUB.

We also added some custom processing which indeed, from what I've tested 
does not create a valid OPF file in some cases.

I did not quite manage to reproduce your situation, could you send to 
the Oxygen XML Editor Support email address (support@oxygenxml.com) a 
sample Docbook project on which the problem can be reproduced.

I'm attaching a modified version of the build file:
OXYGEN_INSTALL_DIR/frameworks/docbook/xsl/epub/bin/build.xml

ANT build file which removed some of the custom processing we perform to 
the OPF file (and which sometimes leads to invalid EPUB archives).
Can you copy it over the initial ANT build file and see if your 
situation is corrected?

Regards,
Radu

Radu Coravu
<oXygen/>  XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
>
> -------- Original Message --------
> Subject: [docbook-apps] Images do not extract to epub OPF manifest
> Date: Sat, 21 May 2011 16:26:45 +1000
> From: redlettucemail <redlettucemail@mailscan.acenet.net.au>
> To: docbook-apps@lists.oasis-open.org
>
>
>
> I am transforming a DB5 (1.76) book to epub using oXygen 12.2, and
> running epubcheck gives me a warning that images are not declared in the
> OPF file. Inexpicably, I do get only one image showing in the manifest:
> "<manifest>
> <item id="ncxtoc" media-type="application/x-dtbncx+xml" href="toc.ncx" />
> <item media-type="text/css" id="css" href="../epub3.css" />
> <item id="cover" href="cover.html" media-type="application/xhtml+xml" />
> <item id="coverimage" href="images/frontcover.jpg"
> media-type="image/jpeg" />
> <item id="d0e274" href="pr01.html" media-type="application/xhtml+xml" />
> <item id="d0e306" href="chap1.html" media-type="application/xhtml+xml" />
> <item id="d0e350" href="sec1.2.html" media-type="application/xhtml+xml" />
> <item id="d0e403" href="sec1.3.html" media-type="application/xhtml+xml" />
> <item id="d0e424" href="chap2.html" media-type="application/xhtml+xml" />
> *<item id="d0e451" href="images/Figure2-1.gif" media-type="image/gif" />*
> <item id="d0e715" href="sec2.2.html" media-type="application/xhtml+xml" />
> ....."
> I've checked the XML markup, and every image in each chunk has the
> imagedata file format declared as GIF, e.g.:
> "<figure pgwide="1" xml:id="fig2.2" floatstyle="before">
> <title>Australia’s meso-scale marine bioregions. Source: Department of
> Environment,
> Water, Heritage and the Arts.</title>
> <titleabbrev>Australia’s meso-scale marine bioregions</titleabbrev>
> <mediaobject>
> <textobject>
> <phrase>Australia’s meso-scale marine bioregions</phrase>
> </textobject>
> <imageobject role="fo">
> <imagedata fileref="images/Figure2-2.gif" width="70%" align="center"
> format="GIF" />
> </imageobject>
> <imageobject role="html">
> <imagedata fileref="images/Figure2-2.gif" width="450px" align="center"
> format="GIF" />
> </imageobject>
> </mediaobject>
> </figure>"
> I can't see what markup I'm missing to get images to extract to the OPF.
> Any help appreciated thanks.
> Dave Gardiner
>

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="dist" name="ANTProject">
  <!--
    Convert DocBook documents into ePUB files.
    
    ePUBis defined by the IDPF at www.idpf.org and is made of 3 standards:
    - Open Publication Structure (OPS)
    - Open Packaging Format (OPF) 
    - Open Container Format (OCF)
  -->
  
  <!-- Path to Docbook XML file. -->
  <property name="xmlFile" value=""/>
  
  <!-- Stylesheet for META-INF/container.xml, OPF and NCX output files. -->
  <property name="stylesheetFile" value="../docbook.xsl"/>
  
  <!-- Stylesheet for image src attribute in HTML files.  -->
  <property name="imagesStylesheetFile" value="../images.xsl"/>
  
  <!-- Stylesheet for add images in content.opf files. -->
  <property name="removeOldImagesStylesheetFile" value="../removeImagesContentOpf.xsl"/>
  
  <!-- Stylesheet for add images in content.opf files. -->
  <property name="addNewImagesStylesheetFile" value="../addImagesContentOpf.xsl"/>
  
  <!-- Path where the output ePUB file will be saved. -->
  <property name="outputFile" value=""/>
  
  <dirname property="xmlFileDir" file="${xmlFile}"/>
  <dirname property="outputDir" file="${outputFile}"/>
  <property name="metadir" value="${outputDir}/META-INF/"/>
  <property name="oebpsdir" value="${outputDir}/"/>
  <property name="outputTempDir" value="${outputDir}/../temp"/>
  
  <path id="classpath">
    <pathelement path="${java.class.path}"/>
  </path>
  
  <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
  
  <target name="dist">
    <!-- Recreate output directory -->
    <delete dir="${outputDir}"/>
    <mkdir dir="${outputDir}"/>
    <!-- Temporary files. -->
    <property name="xincluded-profiled.xml" value="${outputDir}/xincluded-profiled.xml"/>
    <property name="dummy.xml" value="${outputDir}/dummy.xml"/>
    <!-- Copy the mime type file-->
    <copy file="mimetype" todir="${outputDir}" overwrite="true"/>
    <xslt in="${xmlFile}" out="${xincluded-profiled.xml}" style="../../profiling/profile.xsl"
      classpath="classpath">
      <!--OXYGEN PATCH for EXM-19733-->
      <xmlcatalog>
        <catalogpath>
          <pathelement location="../../../catalog.xml"/>
        </catalogpath>
      </xmlcatalog>
      <sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration"
        value="org.apache.xerces.parsers.XIncludeParserConfiguration"/>
      <param name="profile.arch" expression="${profile.arch}" if="profile.arch"/>
      <param name="profile.audience" expression="${profile.audience}" if="profile.audience"/>
      <param name="profile.condition" expression="${profile.condition}" if="profile.condition"/>
      <param name="profile.conformance" expression="${profile.conformance}" if="profile.conformance"/>
      <param name="profile.lang" expression="${profile.lang}" if="profile.lang"/>
      <param name="profile.os" expression="${profile.os}" if="profile.os"/>
      <param name="profile.revision" expression="${profile.revision}" if="profile.revision"/>
      <param name="profile.revisionflag" expression="${profile.revisionflag}" if="profile.revisionflag"/>
      <param name="profile.role" expression="${profile.role}" if="profile.role"/>
      <param name="profile.security" expression="${profile.security}" if="profile.security"/>
      <param name="profile.status" expression="${profile.status}" if="profile.status"/>
      <param name="profile.userlevel" expression="${profile.userlevel}" if="profile.userlevel"/>
      <param name="profile.vendor" expression="${profile.vendor}" if="profile.vendor"/>
      <param name="profile.wordsize" expression="${profile.wordsize}" if="profile.wordsize"/>
      <param name="profile.attribute" expression="${profile.attribute}" if="profile.attribute"/>
      <param name="profile.value" expression="${profile.value}" if="profile.value"/>
    </xslt>
    <!-- The transformation for EPUB output. -->
    <xslt style="${stylesheetFile}" in="${xincluded-profiled.xml}" out="${dummy.xml}" classpath="classpath">
      <sysproperty key="org.apache.xerces.xni.parser.XMLParserConfiguration"
        value="org.apache.xerces.parsers.XIncludeParserConfiguration"/>
      <xmlcatalog>
        <catalogpath>
          <pathelement location="../../../catalog.xml"/>
        </catalogpath>
      </xmlcatalog>
      <param name="base.dir" expression="${oebpsdir}"/>
      <param name="epub.metainf.dir" expression="${metadir}"/>
      <param name="epub.oebps.dir" expression="${oebpsdir}"/>
      <param name="epub.opf.fileref" expression="content.opf"/>
      <param name="xml.dir" expression="${xmlFileDir}"/>
      <param name="chunker.output.encoding" expression="${chunker.output.encoding}" if="chunker.output.encoding"/>
      <param name="chunk.quietly" expression="${chunk.quietly}" if="chunk.quietly"/>
    </xslt>
    <!-- Remove the not necessary output files. -->
    <delete file="${dummy.xml}"/>
    <delete file="${xincluded-profiled.xml}"/>
    
    <mkdir dir="${outputTempDir}"/>
    <!-- Remove old images from content.opf. -->
    <copy file="${outputDir}/content.opf" tofile="${outputTempDir}/content.opf"></copy>
    <!--<xslt style="${removeOldImagesStylesheetFile}" in="${outputDir}/content.opf" out="${outputTempDir}/content.opf" classpath="classpath">
      <xmlcatalog>
        <catalogpath>
          <pathelement location="../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
        </catalogpath>
      </xmlcatalog>
    </xslt>-->
    <copy file="${outputTempDir}/content.opf" tofile="${outputDir}/content.opf" overwrite="true"/>
    <!-- Add new images from content.opf. -->
    <foreach target="images" param="inputFile">
      <path>
        <fileset dir="${outputDir}">
          <include name="**/*.html"/>
        </fileset>
      </path>
    </foreach>
    <copy todir="${outputDir}" overwrite="true">
      <fileset dir="${outputTempDir}">
        <include name="**/*.html"/>
      </fileset>
    </copy>
    <delete dir="${outputTempDir}"/>
    
    <!-- ZIP the EPUB file, keep the mimetype uncompressed. -->
    <zip destfile="${outputFile}" basedir="${outputDir}" compress="true"
      includes="META-INF/container.xml,toc.ncx, content.opf,container.opf, 
                 **/*.html,**/*.HTML,
                 **/*.jpg,**/*.jpeg,**/*.gif,**/*.png,**/*.svg,**/*.JPG,**/*.JPEG,**/*.GIF,**/*.PNG,**/*.SVG"/>
    <zip destfile="${outputFile}" basedir="${outputDir}" includes="mimetype" update="true"
      keepcompression="true" compress="false"/>
  </target>
  
  <target name="images">
    <basename file="${inputFile}" property="fileName"/>
    <xslt style="${imagesStylesheetFile}" in="${inputFile}" out="${outputTempDir}/${fileName}" classpath="classpath">
      <xmlcatalog>
        <catalogpath>
          <pathelement location="../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
        </catalogpath>
      </xmlcatalog>
      <param name="inputDir" expression="${xmlFileDir}"/>
      <param name="outputDir" expression="${outputDir}"/>
      <param name="imagesDir" expression="images"/>
    </xslt>
    <!--<xslt style="${addNewImagesStylesheetFile}" in="${outputDir}/content.opf" out="${outputTempDir}/content.opf" classpath="classpath">
      <xmlcatalog>
        <catalogpath>
          <pathelement location="../../../../xhtml11/dtd/xhtmlcatalog.xml"/>
        </catalogpath>
      </xmlcatalog>
      <param name="inputFile" expression="${outputTempDir}/${fileName}"/>
    </xslt>-->
    <copy file="${outputTempDir}/content.opf" tofile="${outputDir}/content.opf" overwrite="true"/>
  </target>
</project>


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]