cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Assaf Arkin <>
Subject Re: XSLT API Proposal (Draft 2)
Date Tue, 08 Feb 2000 21:31:18 GMT
> Frankly I like TransformContext a bit better than Transformation.  It gets
> the idea across that this is a one-per-thread object, for the purpose of
> non-static data during the transform.  I'm not sure if a Transformer is the
> stylesheet, or if the Transformation is the stylesheet.

Actually, context is most often used not for one-per-thread, but for

In Servlets and EJB the context belongs to an instance of the object. In
JAAS you create one context per login operation. And so on.

One per thread is achieved only by specifying that a method is not
reentrant either in the docs, by throwing an exception, etc.

You can always create one context and share it between threads.

> Processor or TransformFactory?  I kind of like TransformFactory better.
> And then I was thinking...
> Maybe we could back out of having a SourceTree object, which introduces
> certain problems, and just have:
> public interface TransformFactory
> {
> Transform createTransform(XSLTInputSource source);
> XSLTInputSource getAssociatedStylesheet(XSLTInputSource source, String
> media, String title, String charset);
> // TransformSourceHandler just extends DocumentHandler with a getTransform
> () method.
> TransformSourceHandler getTransformSourceHandler(Parser parser, String
> baseID);
> }

Question, if I call getAssociatedStylesheet and then createTransform, do
I need to parse the source document twice? How will it work with SAX? Or
is getAssociatedStylesheet a convenience method?

How about TransformerResolver? Will be used to return a transformer
given the stylesheet during processing, or return one given not
stylesheet PI, so you can keep calling the same process() method but
have some caching/default mechanism in the background.

> Transformer and Transformation just seem too close to me... I think people
> would mix them up.  What do other's think?


> OK, let me try this as a close-to equivalent:
> TransformFactory tfactory = XSLTFactory.newTransformFactory(...);
> XSLTInputSource transformSource = tfactory.getAssociatedStylesheet(
> inputSource, null, null, null);
> // I'm going to assume the processor should be able to handle an embedded
> stylesheet
> Transform transform = (null != transformSource) ? tfactory.createTransform(
> transformSource)
>           : tfactory.createTransform(new XSLTInputSource("default.xsl");
> transform.process(transform.getContext(), sourceDoc, oprop);

How does that work with SAX?


> -scott

Assaf Arkin                                 
CTO, Exoffice Technologies, Inc.              

View raw message