Re: [Q] Help using Docbook [xsltproc]



On Fri, Mar 14, 2003 at 01:03:09AM -0500, Daniel Carrera wrote:
> Hello,
> 
> I'm trying to get the docbook tools working on my system so I can turn a 
> docbook document into XHTML or other formats.
> 
> I'm looking at the GDP Handbook:
> 
> http://www.inkstain.net/fleck/handbook/gettingstarted.html#installingdocbook
> 
> I've followed the installation instructions of section 3.2.3 and now I 
> have xmllint, xsltproc and xmlcatalog in my system.
> 
> xmllint and xmlcatalog seem to do what they should.  I am struggling with 
> xsltproc though.

Have you run the buildDocBookCatalog script so you have a XML catalog
on your system?  This is an important speed enhancement so the tools
will not fetch the DTD and schemas everytime you run xmllint and
xsltproc.

> Section 3.3.2 says that I should use it like this:
> 
> $ xsltproc --noout -o output  stylesheet.xsl filename.xml
> 
> My question:
> Which style sheet should I be using there? (say I want to make an XHTML 
> file).
> 
> As indicated in 3.2.3, I have the docbook DTD in the 
> $PREFIX/share/xml/docbook/xml-dtd-4.1.2 directory and the style sheets in 
> the $PREFIX/share/xml/docbook/xsl-stylesheets-1.48 directory.

You can do one of two things when specifying a stylesheet.  You can
specify the full path to the stylesheet or you can specify the
canonical URI for the stylesheet.  If you know where the stylesheet is
located it usually is easier to specify the full path.  However with a
working XML Catalog you can specify the URI.  An example of a URI for
the HTML stylesheets is:

http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl

Using the canonical URI is also nice because you just need to change
different parts of the URI to change stylesheet versions and types of
stylesheets.  For example if you want version 1.45 of the HTML docbook
stylesheets you would use:

http://docbook.sourceforge.net/release/xsl/1.45/html/docbook.xsl

Also if you want to use the most current version of the XHTML docbook
stylesheets you can use:

http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl

So by just manipulating the URI you can choose different types of
stylesheets locally on your computer.

> I've been using the gnome-applet-template.xml as an example and I have 
> been unable to turn it into xhtml.  I have been trying style sheets at 
> random and they all produce an output with *no* XHTML tags.
> 
> Could someone show me the command-line instruction to turn 
> gnome-applet-template.xml into an XHTML file?

The command to change the DocBook into a single xhtml file is:

xsltproc --noout -o gnome-applet-template.xhtml $PREFIX/share/xml/docbook/xsl-stylesheets-1.48/xhtml/docbook.xsl gnome-applet-template.xml

Thanks for your comments on the GDP Handbook.  I think I'll add
something about canonical URIs and include a concrete example of how
to change a DocBook file into a single HTML file.

Eric Baudais



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