cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Boag/CAM/Lotus" <>
Subject Re: XSLT API Proposal (Draft 2)
Date Tue, 08 Feb 2000 20:04:19 GMT

"Steve Muench" <> wrote:
> Or maybe even better:
>    (*) Construct a Stylesheet, given "style.xsl" as input
>    (*) For each "run" of this stylesheet,
>        => Construct a XSLTProcessor(Stylesheet) and
>        => Call process(Source,Params,Result)

OK, if I rename Transform to Stylesheet (with reservations), and TContext
to XSLTProcessor (probably a good idea, though if feels like "Processor" is
something that can be used over and over), and take the example I did for
Tangi, we get:

StylesheetFactory sfactory = XSLTFactory.newStylesheetFactory(...);
Params params = new Params();  // Bag of params..
params.set("foo", "", "hello");

Stylesheet stylesheet1 = sfactory .createStylesheet(new InputSource
XSLTProcessor processor1 = stylesheet1.getProcessor();

Stylesheet stylesheet2= sfactory.createStylesheet(new InputSource("t2.xsl"
XSLTProcessor processor2 = stylesheet2.getProcessor();

Stylesheet  stylesheet3 = sfactory.createStylesheet(new InputSource
XSLTProcessor processor3= stylesheet3 .getProcessor();

processor3.setResultTarget(new Result(System.out), oprop));
processor2.setResultTarget(new Result(processor3), oprop));
processor1.process(new InputSource("foo.xml"), params, new Result(
processor2), null);

(You had a "new" on the XSLTProcessor, but I think it better to get if from
the stylesheet in order to reduce the number of concrete constructors).

How does this look to people?  I rather like it...


View raw message