GNOME Bugzilla – Bug 57115
Not chunking using an XSLT customization layer for DocBook stylesheets
Last modified: 2009-08-15 18:40:50 UTC
When I use 'xsltproc' with Norman Walsh's DocBook XSL stylesheets (v1.40) to process a large DocBook XML file, it *correctly* chunks each chapter and <sect1> into a separate HTML file. I used something like: $ xsltproc /usr/share/docbook-xsl-1.40/html/docbook.xsl myfile.xml It then generates a bunch of files as I want it to. However, when I create my own XSLT customization layer that sits on top of Norm's stylesheets, I get an error that says chunking is not supported. Here is the command execution: [dyork@enchilada html]$ xsltproc --version /usr/share/sgml/e-smith.xsl ../userguide.xml Using libxml 20312 and libxslt 1300 xsltproc was compiled against libxml 20312 and libxslt 1300 libxslt 1300 was compiled against libxml 20312 Chunking isn't supported with libxslt <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> [dyork@enchilada html]$ Here is what is the beginning of the XSLT customization layer: <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0' xmlns="http://www.w3.org/TR/xhtml1/transitional" exclude-result-prefixes="#default"> <!-- Change this to the path to where you have installed Norman Walsh's XSL stylesheets --> <xsl:import href="/usr/share/sgml/docbook-xsl-1.40/html/chunk.xsl"/> Now, if I change the reference to: <xsl:import href="/usr/share/sgml/docbook-xsl-1.40/html/docbook.xsl"/> then 'xsltproc' runs perfectly fine and generates a *single* HTML file that includes the customizations I have made to the DocBook stylesheets. So the customization layer works when importing 'docbook.xsl', but not when importing 'chunk.xsl'. I have noted this problem as well when using Norm's "Slides" XSL stylesheets, as they also call 'chunk.xsl'. Trying to use 'xsltproc' with the Slides stylesheet also generates the message: Chunking isn't supported with libxslt If there is any more information I can provide, please let me know. Dan
Look at html/chunker.xsl That's where the error comes from: --------------------------------------------<xsl:template name="make-relative-filename"> <xsl:param name="base.dir" select="'./'"/> <xsl:param name="base.name" select="''"/> <xsl:variable name="vendor" select="system-property('xsl:vendor')"/> <xsl:choose> <xsl:when test="contains($vendor, 'SAXON')"> <!-- Saxon doesn't make the chunks relative --> <xsl:value-of select="concat($base.dir,$base.name)"/> </xsl:when> <xsl:when test="contains($vendor, 'Apache')"> <!-- Xalan doesn't make the chunks relative --> <xsl:value-of select="concat($base.dir,$base.name)"/> </xsl:when> <xsl:otherwise> <xsl:message terminate="yes"> <xsl:text>Chunking isn't supported with </xsl:text> <xsl:value-of select="$vendor"/> </xsl:message> </xsl:otherwise> </xsl:choose> </xsl:template> -------------------------------------------- The only way to make libxslt work with this code is to fake being SAxon or Apache. This is pretty bad and Norm promised to fix this in the next release. So this is not a libxslt bug. I have put a workaround to this in libxslt/functions.c (search for DOCBOOK_XSL_HACK). You can either: - change that part of the code to not check that the stylesheet name contains "chunk" - rename your file containing the customization layer to have "chunk" in its name If this sounds horrible, yes it is but I don't think I'm guilty for this :-\ Daniel
Ugh... a bit of a mess. Thanks for the tip - I renamed my stylesheet with "-chunk" in the filename and it worked fine! Geez... I'll check Norm's buglist, too, to make sure this is being fixed. Thanks, Dan
Should be fixed with libxslt-1.0 and the latest docbook XSLT stylesheets Daniel
Yes... all set and working great! Thanks! Dan