groff
[Top][All Lists]
Advanced

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

[Groff] Announce: HTML to tbl(1) conversion using XSLT


From: Michael(tm) Smith
Subject: [Groff] Announce: HTML to tbl(1) conversion using XSLT
Date: Fri, 7 Apr 2006 14:35:18 +0900
User-agent: Mutt/1.5.9i

I've written an XSLT stylesheet that converts HTML tables to
tbl(1) markup. A copy of it is attached. It's also online:

  
http://cvs.sourceforge.net/viewcvs.py/*checkout*/docbook/xsl/manpages/table.xsl

I welcome comments and suggestions (and bug reports) about it. It
works well for the test cases I've run against it, but I'm sure
there's still some room for improvement.

It supports most features of HTML table markup, including Rowspan
and Colspan. Nested tables-within-tables -- which are valid in
HTML but not supported in tbl -- it handles by "extracting" the
nested table and placing it after its parent, with a marker and
title to indicate that it's a nested table.

It deals with Tfoot just be placing the Tfoot rows (as normal
rows) at the end of table (because tbl has no support for having a
running table footer).

For Thead, it optionally outputs the Thead rows using the .TS H &
.TH mechanism (ms macros) to form a running header. But I have not
yet gotten that working for man output (even after trying to work
around the .TH macro naming conflict). I'll send a separate
message to the list asking for help on that.

I created the stylesheet for enabling conversion of tables in
DocBook XML source to man-page output. So it's not a standalone
stylesheet that could be used as-is; if you wanted to use it for
other purposes, you'd need to adjust it.

That said, I tried to make it as portable as possible, and not tie
it to the rest of the DocBook XSL stylesheets code any more than
necessary. There are only two places in it where it relies on code
that's outside the stylesheet itself: it calls two named
templates, "copy-string" and "trim.text", that are in some XSLT
library code that is packaged with the DocBook XSL distribution:

  http://cvs.sourceforge.net/viewcvs.py/*checkout*/docbook/xsl/lib/lib.xweb

But that library code is portable also, so you could copy the
the "copy-string" and "trim.text" templates from there. Or
actually, probably better to copy it from here:

  http://docbook.xml-doc.org/snapshots/xsl/lib/lib.xsl

(Because the DocBook stylesheets use a literate programming
system, and the lib.xweb source file has embedded doc; the lib.xsl
file is generated by the build.)

It falls under the same license and the rest of the DocBook XSL
stylesheets code -- an MIT-style license:

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

So you're basically free to do whatever you want with it.

  --Mike

Attachment: table.xsl
Description: application/xml


reply via email to

[Prev in Thread] Current Thread [Next in Thread]