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
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'"/>