[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Epub chunking customization
Hi, I'm trying to generate Epub file with autogenerated ToC in a separate chunk at a specific position. I've tried to follow the howto at http://www.sagehill.net/docbookxsl/ChunkingCustomization.html to the best of my ability but no matter what I do, xsltproc just prints lots of I/O errors when I add customized <xsl:template name="chunk"> that relies on <xsl:apply-imports/>. Here's the whole minimal stylesheet that doesn't work. I want to add some content customizations as well (those should replace the first import according to the howto) but let's keep it simple. The imports and includes are adapted from epub3/chunk.xsl. Including epub3/chunk.xsl itself instead makes no difference. > <?xml version='1.0'?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> > <xsl:import href="http://docbook.sourceforge.net/release/xsl-ns/current/epub3/docbook.xsl"/> > <xsl:import href="http://docbook.sourceforge.net/release/xsl-ns/current/xhtml/chunk-common.xsl"/> > <xsl:include href="http://docbook.sourceforge.net/release/xsl-ns/current/xhtml/chunk-code.xsl"/> > <xsl:include href="http://docbook.sourceforge.net/release/xsl-ns/current/epub3/epub3-chunk-mods.xsl"/> > > <xsl:param name="generate.toc"> > book title > </xsl:param> > <xsl:param name="process.empty.source.toc" select="1"/> > <xsl:param name="process.source.toc" select="1"/> > > <xsl:template name="chunk"> > <xsl:param name="node" select="."/> > <xsl:variable name="ret"> > <xsl:choose> > <xsl:when test="local-name($node) = 'toc'">1</xsl:when> > <xsl:when test="local-name($node) = 'preface'">0</xsl:when> > <xsl:otherwise> > <xsl:apply-imports/> > </xsl:otherwise> > </xsl:choose> > </xsl:variable> > <xsl:message> > <xsl:text>Chunk test: </xsl:text> > <xsl:value-of select="local-name($node)"/> > <xsl:text> - </xsl:text> > <xsl:value-of select="$ret"/> > </xsl:message> > <xsl:value-of select="$ret"/> > </xsl:template> > </xsl:stylesheet> Notice the <xsl:message> near the end. When I run the above file, xsltproc prints this: > xsltproc ../xsl/epub-chunk.xsl ../swarmwise.docbook >/dev/null > Chunk test: book - > Chunk test: bookinfo - > Chunk test: title - > Chunk test: subtitle - > Chunk test: preface - 0 > Chunk test: highlights - > Chunk test: para - > Chunk test: para - > Chunk test: toc - 1 > Chunk test: preface - 0 > Chunk test: epigraph - > Chunk test: para - > Chunk test: para - > Chunk test: part - > Chunk test: title - > Chunk test: chapter - > Chunk test: title - And lots more lines like that with no return value. After that, it starts printing what looks like chunk IDs instead of 0/1 return values: > Note: namesp. add : added namespace before processing Swarmwise > Chunk test: - > Chunk test: preface - 0 > Chunk test: preface - 0 > Chunk test: preface - 0 > Chunk test: book - book-idm139645148695504 > Chunk test: book - > Chunk test: book - > Chunk test: book - book-idm139645148695504 > Chunk test: preface - 0 > Chunk test: preface - 0 > Chunk test: preface - 0 > Chunk test: book - book-idm139645148695504 > Chunk test: book - > Chunk test: book - > Chunk test: book - book-idm139645148695504 And after that, the chunk test output includes even pieces of text from the book itself instead of 0/1 return values - chapter titles, section titles and even entire paragraphs converted into plain text with no XML markup. Here's what xsltproc prints when I comment out the <xsl:message> block: > xsltproc ../xsl/epub-chunk.xsl ../swarmwise.docbook >/dev/null > Note: namesp. add : added namespace before processing Swarmwise > Error preface is not a chunk! > Writing OEBPS/ for preface(predmluva) > I/O error : Is a directory > I/O error : Is a directory > runtime error: file file:///usr/share/sgml/docbook/xsl-ns-stylesheets/xhtml/chunker.xsl line 172 element document > xsltDocumentElem: unable to save to OEBPS/ > Error preface is not a chunk! > Writing OEBPS/ for preface > I/O error : Is a directory > I/O error : Is a directory > runtime error: file file:///usr/share/sgml/docbook/xsl-ns-stylesheets/xhtml/chunker.xsl line 172 element document > xsltDocumentElem: unable to save to OEBPS/ > Writing OEBPS/ for section(hejno-je-otevrene) > I/O error : Is a directory > I/O error : Is a directory > runtime error: file file:///usr/share/sgml/docbook/xsl-ns-stylesheets/xhtml/chunker.xsl line 172 element document > xsltDocumentElem: unable to save to OEBPS/ I'm using DocBook XSL NS Stylesheets 1.78.0 and xsltproc --version prints this: > Using libxml 20901, libxslt 10128 and libexslt 817 > xsltproc was compiled against libxml 20901, libxslt 10128 and libexslt 817 > libxslt 10128 was compiled against libxml 20901 > libexslt 817 was compiled against libxml 20901 I've also tried changing the imports according to xhtml/chunk.xsl (to generate normal chunked XHTML instead of Epub) but that just gave me slightly different error messages from xsltproc. When I import only epub3/chunk.xsl and comment out the custom "chunk" template, I get usable chunked Epub data with no error messages from xsltproc. What am I missing? Regards, Martin Doucha
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]