You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Jon Smirl <jo...@mediaone.net> on 2000/06/21 19:57:16 UTC

Xalan-C: custom output stage

XT allows custom output stages:

 <xsl:output method="fop:org.apache.fop.apps.PDFOutputHandler"
             xmlns:fop="http://www.jclark.com/xt/java"/>

This allowed me to feed the output of the sheet directly into FOP via SAX
events.

I can write my own FormatterListener that will redirect the output in to
FOP, but process() in StylesheetRoot.cpp will need to changed to allow the
dynamic creation of the user written FormatterListener's. One solution would
be to push the logic in the output method case of process() back into
FormatterListener and then I could override it. This technique can also be
used to trigger the building of DOM tree output instead of streaming.

Another scheme I used involved monitoring the output SAX events from the
XSLT processor for PI's. Initially I would set the XSLT engine to send
output events to my monitoring object. I would then output a PI to cause the
right output stage to be created. This scheme allowed a single sheet to
generate HTML or PDF depending on it's input parameters.

On the other hand there may already be some scheme for doing custom output
stages in Xalan-C and I just can't figure it out. Here's some useful custom
output stages:

1) FOP - XSL-FO to PDF
2) Xalan - XSL to XSL chaining
3) SVG - for direct SVG viewing
4) Direct email generation
5) Database input
6) DOM creation (already have this)
7) Streaming (already have this)

I don't really want to make a DOM and then feed it to the first five. The
first five already have their own internal DOMs which aren't based on
Xalan/Xerces. Chaining via SAX or FormatterListener events is better.

Jon Smirl
jonsmirl@mediaone.net