[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Howto make HTML from Docbook-XML?



debacle@knorke.in-berlin.de (W. Borgert) writes:
> Is DSSSL outdated and I should use XSL?

DSSSL is not "outdated", but I find that these days using XSL seems to
require less intimate knowledge of the tools, making it the path of
least resistance.

I don't think the printed materials look as nice yet---I'm thinking of
the PDFs you get running stuff through Fop---but if PassiveTeX ever
gets packaged, it will probably get even harder to justify using
anything else, as I've heard its output rivals anything JadeTeX was
able to do.

> The stylesheets seem to produce always one large HTML file from a
> book or article, while I would prefer the way db2html handles it.
> Is there a trick, how to do this?

If you read through the documentation closely---I think I found it on
nwalsh.com, but I'm not sure, maybe it was in /usr/share/doc---you'll
find references to xtchunk.xsl, which will do what you want---and
despite the fact that the docs make it sound like it's XT specific,
xsltproc seems to chew on it just fine.

For my documents, I use a customization template like the following:

<?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">
  <xsl:import href="/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/html/xtchunk.xsl"/>
  <xsl:variable name="html.stylesheet">guide.css</xsl:variable>
  <xsl:variable name="toc.section.depth">2</xsl:variable>
  <xsl:variable name="section.autolabel">1</xsl:variable>
  <xsl:variable name="generate.division.toc">0</xsl:variable>
  <xsl:variable name="toc.list.type">ul</xsl:variable>
  <xsl:variable name="use.extensions">1</xsl:variable>
  <xsl:variable name="use.id.as.filename">ul</xsl:variable>
</xsl:stylesheet>

I put this in a file named guide.xsl, and I invoke xsltproc as:

xsltproc guide.xml guide.xsl

And it produces multiple files.  When I go through and finish IDing
all my articles/sections, it'll even name them they way I want. :-)

> If I have to use XSL, which XSLT processor in Debian is suitable for
> the docbook-xsl-stylesheets?  I tried xsltproc, which worked fine,
> but maybe another is better/faster/ whatever?

I like xsltproc---it's seems fast, at least since 0.13 or so it seems
pretty darn complete, etc.

I have considered playing with saxon because it has the ability to do
includes in a way that I gather doesn't require pre-processing them to
escape entities, and since some of my documentation could benefit from
that, it's tempting.  But it's *almost* as easy to have make just
preprocess them---I use the following make rule and snippet of perl to
encode them:

%.xml : %; perl -MHTML::Entities -pe 'encode_entities ($$_)' $< > $@

Mike.
-- 
"One does not write satire anymore; one merely tries to stay half a
step ahead of reality." -- Jon Carroll



Reply to: