I have done some initial experiments using STX (Streaming Transformations for XML see: http://stx.sourceforge.net/ ) together with Cocoon and this far it seem to work well.

STX is similar to XSLT but the transformation rules reacts on events (SAX) instead of matching on a tree model as XSLT. This means that an STX processor doesn't have to store all the input data as an XSLT processor normally does (this could in principle be done in special cases for XSLT also, but it has been discussed on the Xalan-dev list and it seem to be very complicated to do in pracice ). Sylvain and Vadim seemed entusiastic about STX some while ago http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=101613150500829&w=2.

There is a Java implementation of STX called Joost http://joost.sourceforge.net/ that implements the TrAX interfaces. To use it you just need joost.jar and log4j.jar (Joost has excplicit references to log4j everywhere in the code :( ). And as it implements TrAX the TraxTRansformer can be used as is, just put something like:

<map:transformer name="stx" pool-grow="2" pool-max="32" pool-min="8"
src="org.apache.cocoon.transformation.TraxTransformer">
<use-request-parameters>false</use-request-parameters>
<use-browser-capabilities-db>false</use-browser-capabilities-db>
<transformer-factory>net.sf.joost.trax.TransformerFactoryImpl</transformer-factory>
</map:transformer>

in the component section in the sitemap and then you can use it in the pipelines, e.g.

<map:match pattern="*.html">
<map:generate src="{1}.xml"/>
<map:transform type="stx" src="{1}.stx"/>
<map:serialize/>
</map:match>

I have just tried it at some small examples this far and have not done any benchmarking, but if it is stable enough it should be very usefull for handling e.g. large data sets from databases, something that can consume large amounts of memory while processed in Xalan.

/Daniel Fagerstrom



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to