www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - ddoc-xml, second demo (xsl-fo output, = PDF)

Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

The second demo of my ddoc-xml output doesn't change any of the files 
included in the first one, but adds:

ddoc2fo.xsl   - an XSLT stylesheet for transforming DDOC-XML to XSL-FO

Now you can make PDF documentation, but you'll need a tool that renders 
the XSL-FO to the PDF file, for example Apache FOP (i'm using it, so all 
the workarounds for missing features of FOP are included *g*).
You can get it here: http://xmlgraphics.apache.org/fop/download.html
You might want to set your path enviroment variable to the FOP 
installation directory, so you can easily type "xalan ..." and "fop ..." 
at the command prompt - but you don't need to.

To create PDF from your d source file, you would:
1. Run dmd using xml.ddoc on your source file.
    Use the -Df switch to change the output to some .xml file.
    (You don't really need to do this, but it isn't html...)
2. Run fop on the resulting xml file, using the ddoc2fo transformation.
    e.g. "fop -xml foo.xml -xsl ddoc2fo.xsl -pdf foo.pdf

You can use different output formats with fop, not just pdf (ps, ascii 
text, svg, ...) - just run fop with no arguments, you'll get a usage help.

Todo/Bugs/Missing Features:
1. Not test on real (large) source code :)
2. Page breaks occur almost everywhere, i'm working on a solution.
    (For example you don't want to have the title of a section on one
     page, and the corresponding text on the next)
3. Only tested with Apache FOP, because i don't know another free
    FO-Processor. (And i don't want to spend lots of money for one)
Oct 02 2005