cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kay Michael <>
Subject RE: XSLT API Proposal (Draft 2)
Date Mon, 07 Feb 2000 18:16:45 GMT
> Huh?  Not at all... Transform represents the compiled stylesheet.
> XSLTExecContext was meant to represent a session context for the XSLT
> processor.

That's the trouble with these abstract names: people can come to wrong
conclusions! I had worked out that I had come to the wrong conclusion, but
hadn't worked out exactly where I was wrong.

I don't currently have anything corresponding to XSLTProcessor, but I think
I now understand what it is, and that that is the right name.

Saxon's PreparedStyleSheet corresponds to your Transform.

Saxon's StyleSheetInstance corresponds to your TransformContext. Both
horrible names.

How about Processor, Transformer, and Transformation? That gets across the
idea that one transformer can do many transformations.

Following this I'm now thinking along the lines of:

XSLTProcessor processor = new Saxon();
Transformer transformer = processor.makeTransformer(new

for (i=0; i<100; i++) {
	OutputProperties oprop = new OutputProperties();
	oprop.setIndent("yes");	// or true, I don't care
	oprop.setProperty("", "bananas");
	oprop.setProperty("http://org.apache.xalan/line-terminator", "\n");
	oprop.setProperty("http://com.icl.saxon/indent-spaces", "3");
	OutputMethod omethod = new UserDefinedOutputMethod();
	transformation = transformer.makeTransformation();
	transformation.setParameter("name", "value");
	transformation.process(new XSLTInputSource(uri[i]), oprop);
	String mime = oprop.getMediaType();

This is the easy case. In Saxon I have a Builder class and a DocumentInfo

DocumentInfo sourceDoc = (new Builder()).build(inputSource);
transformation.process(sourceDoc, oprop);

Then I can also do things like (this is next release stuff, adapted to the
terminology above)

DocumentInfo sourceDoc = (new Builder()).build(inputSource);
String styleURI = sourceDoc.getAssociatedStylesheet();
if (styleURI.startsWith('#')) {
	transformer =
} else {
	transformer = processor.makeTransformer(new
(transformer.makeTransformation()).process(sourceDoc, oprop);

Mike Kay

View raw message