« Return to Thread: XML Processing on a Mac

Re: XML Processing on a Mac

by Cheetos :: Rate this Message:

Reply to Author | View in Thread

Johnson, Eric wrote:
I want to set up my Mac to process DocBook using XSLT and not the Jade
stuff. Can somebody offer a few pointers?

Just went through this over the last week.  Ended up with the following which is working quite well for me on a MacbookPro.  I've a docbook file from which I create chunked HTML for a doc hosts and a PDF for peer review.

  * xsltproc, from Fink
  * docbook-5.0CR1, from docbook.org
  * docbook5ns-xsl-1.71.0, from docbook.org (note it's docbook5...)
  * fop-0.93, from xmlgraphics.apache.org

Here's my build.sh script exhibiting parameters and the like:

---- start ----
#!/usr/bin/env bash

DOC=$1
XSLT=xsltproc
XSLDIR=docbook5ns-xsl-1.71.0
FO_XSL=$XSLDIR/fo/docbook.xsl
CHUNK_XSL=$XSLDIR/xhtml/chunk.xsl
FOP=./fop-0.93/fop
FOPEXT="--stringparam  fop1.extensions 1"

rm -rf build
mkdir -p build/{html,fo,pdf}

echo transforming docbook to chunked html
$XSLT --stringparam base.dir build/html/ $CHUNK_XSL $DOC.docbook
cp -r images build/html/

echo transforming docbook to fo
$XSLT --output build/fo/$DOC.fo $FOPEXT $FO_XSL $DOC.docbook

echo transforming fo to pdf
$FOP -fo build/fo/$DOC.fo -pdf build/pdf/$DOC.pdf
---- end ----

The end result is  a PDF replete with bookmarks (note it's fop1.extensions, not fop.extensions as was the case with fop 0.20).

FWIW, I ended up using Emacs with nxml-mode as my docbook editor.  Although I've been using Eclipse for the last few years, I had trouble getting it setup, especially with the RelaxNG schema that Docbook5 pushes.  I'd been an emacs user prior so old habits came back.  The mode has good tag completion and helpful hints when the doc is malformed.  Haven't got it working with split docs, however.  


 « Return to Thread: XML Processing on a Mac