]> granicus.if.org Git - docbook-dsssl/commitdiff
Added regression and fix to correct "bug" with namespace-prefixed container elements...
authorKeith Fahlgren <abdelazer@users.sourceforge.net>
Tue, 19 May 2009 03:01:14 +0000 (03:01 +0000)
committerKeith Fahlgren <abdelazer@users.sourceforge.net>
Tue, 19 May 2009 03:01:14 +0000 (03:01 +0000)
xsl/epub/bin/spec/epub_regressions_spec.rb
xsl/epub/docbook.xsl

index e7ebbb3ebb9b091bd656752481ebc35d558e38cc..d12d128cfeba87afe25ec55f25b68811f03a7156 100755 (executable)
@@ -151,6 +151,22 @@ describe DocBook::Epub do
     ents_epubfile.should be_valid_epub  
   end
 
+  # https://sourceforge.net/tracker/index.php?func=detail&aid=2790017&group_id=21935&atid=373747
+  it "should not use a namespace prefix for the container element to help some broken reading systems" do
+    filename = "isbn.xml"
+    shortname = filename.gsub(/\W/, '')
+    tmpdir = File.join(Dir::tmpdir(), shortname); Dir.mkdir(tmpdir) rescue Errno::EEXIST
+    epub = DocBook::Epub.new(File.join(@filedir, filename), tmpdir)
+    epubfile  = File.join(tmpdir, shortname + ".epub")
+    epub.render_to_file(epubfile, $DEBUG)
+    FileUtils.copy(epubfile, "." + shortname + ".epub") if $DEBUG
+    success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{File.expand_path(epubfile)}")
+    raise "Could not unzip #{epubfile}" unless success
+    container_file = File.join(tmpdir, 'META-INF', 'container.xml')
+    container_lines = File.open(container_file).readlines
+    container_lines.to_s.should =~ /<container/
+  end
+
   after(:all) do
     FileUtils.rm_r(@tmpdir, :force => true)
   end  
index a2076cf7d69fc413b0d8f0d17f7c595a479acee9..a1e5ba6ab416b7e1e6be6f926c94b764a01731a5 100644 (file)
@@ -6,14 +6,13 @@
   xmlns:h="http://www.w3.org/1999/xhtml"
   xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/"
   xmlns:ng="http://docbook.org/docbook-ng"
-  xmlns:odfc="urn:oasis:names:tc:opendocument:xmlns:container"
   xmlns:opf="http://www.idpf.org/2007/opf"
   xmlns:stext="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.TextFactory"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xtext="xalan://com.nwalsh.xalan.Text"
 
   extension-element-prefixes="stext xtext"
-  exclude-result-prefixes="exsl db dc h ncx ng opf odfc stext xtext"
+  exclude-result-prefixes="exsl db dc h ncx ng opf stext xtext"
 
   version="1.0">
 
       <xsl:with-param name="doctype-system" select="''"/> <!-- intentionally blank -->
 
       <xsl:with-param name="content">
-        <xsl:element name="odfc:container">
+        <xsl:element namespace="urn:oasis:names:tc:opendocument:xmlns:container" name="container">
           <xsl:attribute name="version">1.0</xsl:attribute>
-          <xsl:element name="odfc:rootfiles">
-            <xsl:element name="odfc:rootfile">
+          <xsl:element namespace="urn:oasis:names:tc:opendocument:xmlns:container" name="rootfiles">
+            <xsl:element namespace="urn:oasis:names:tc:opendocument:xmlns:container" name="rootfile">
               <xsl:attribute name="full-path">
                 <!-- TODO: Figure out how to get this to work right with generation but also not be hardcoded -->
                 <xsl:value-of select="'OEBPS/content.opf'"/>