Re: Pure-XSLT implementation, take 2
"Michael(tm) Smith" <[email protected]> Sun, 16 Apr 2006 02:18:07 +0900
| Newsgroups | gmane.text.docbook.docbook2x.general |
|---|---|
| Message-ID | <[email protected]> |
Steve Cheng <[email protected]> writes: > Well, guess what. > I've got basic DocBook->man output with XSLT alone, Very nice to hear. I will be giving it a try soon. > and so far the output looks perfect, no spurious blank lines anywhere :) In working on the manpages stylesheet in the Docbook XSL distribution, I've found it a major headache to write XSLT code for dealing with prevention of too much or too little blank lines in output. The way I ended up dealing with it is to have the stylesheet do a final pass in which it reads in the entire converted-to-roff rendered output and then does a series of string substitutions on that in order to clean up some things. It is basically the equivalent of running a sed or Perl string-substitution script over the final output. There is of course a not-insignificant performance hit to doing that. But it's not at all excessive. > (It really was a good design decision to use the Man-XML intermediate format; > this helped immensely in debugging.) > > No tables though, unless someone screams for it -- the table algorithm is > complicated enough; I'm not in the mood to reimplement it. FWIW, just about three weeks ago I completed work on an HTML-to-tbl converter, and integrated it into the DocBook project manpages stylesheet. So the manpages stylesheet now fully supports tables. You can try it out with the latest snapshot: http://docbook.sourceforge.net/snapshot/ Or wait for the 1.70.0 release, which will be available in just a few days. If you want to take a quick look at just table-conversion code itself, you can grab it from here: http://cvs.sourceforge.net/viewcvs.py/*checkout*/docbook/xsl/manpages/table.xsl The reason it works to have it convert from HTML (instead of from CALS) is that it imports the HTML stylesheet from the DocBook XSL distribution, uses that to do a first pass over the table to convert it to HTML, then runs the HTML-to-tbl conversion on that. Also, DocBook 5 and the current version of DocBook 4 both, along with CALS support, also support using HTML table markup in DocBook source, so an advantage of the first-convert-to-HTML approach in the manpages stylesheet is that by relying on the HTML stylesheet to "normalize" the table markup into HTML form means that I only needed to write one converter instead of two (one for CALS tables, one for HTML tables). I think that if you wanted to, you could probably integrate that table-conversion code into DocBook2X and/or use it as the basis for writing a CALS table converter. --Mike
smime.p7s
(application/x-pkcs7-signature, 2.3 KB) - not displayed