cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simone Tripodi (JIRA)" <j...@apache.org>
Subject [jira] Updated: (COCOON3-6) The org.apache.cocoon.pipeline.component.sax.XSLTTransformer can be optimized
Date Thu, 30 Apr 2009 09:35:30 GMT

     [ https://issues.apache.org/jira/browse/COCOON3-6?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Simone Tripodi updated COCOON3-6:
---------------------------------

    Attachment: OptimizedXSLT+xsltcTransformer.patch

I developed a modified version of c3-sax default XSLT Transormer (see OptimizedXSLT+xsltcTransformer.patch)
that allows component be reusable, i.e.

XSLTTransformer xsltTransformer = new XSLTTransformer(getClass().getResource("myXSLT.xsl"));

Pipeline pipeline1 = new NonCachingPipeline();
pipeline1.addComponent(new StringGenerator("<x><y/></x>"));
pipeline1.addComponent(xsltTransformer);
pipeline1.addComponent(new XMLSerializer());
pipeline1.setup(System.out);
pipeline1.execute();

Pipeline pipeline2 = new NonCachingPipeline();
pipeline2.addComponent(new StringGenerator("<z><w/></z>"));
pipeline2.addComponent(xsltTransformer); // the XSLT source URL won't be parsed again
pipeline2.addComponent(new XMLSerializer());
pipeline2.setup(System.out);
pipeline2.execute();

Moreover, it supports Xalan XSLTC (see http://xml.apache.org/xalan-j/xsltc_usage.html).

Patch contains test cases and the useless cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XSLTProcessorErrorListener.java
has been removed since it was a TraxErrorListener 'clone' and not used.


> The org.apache.cocoon.pipeline.component.sax.XSLTTransformer can be optimized
> -----------------------------------------------------------------------------
>
>                 Key: COCOON3-6
>                 URL: https://issues.apache.org/jira/browse/COCOON3-6
>             Project: Cocoon 3
>          Issue Type: New Feature
>          Components: cocoon-sax
>    Affects Versions: 3.0.0-alpha-2
>            Reporter: Simone Tripodi
>            Assignee: Cocoon Developers Team
>            Priority: Minor
>             Fix For: 3.0.0-alpha-2
>
>         Attachments: OptimizedXSLT+xsltcTransformer.patch, XSLTTransformerOptimization.patch
>
>
> Every time the XSLTTransformer#setXMLConsumer method is called, the XSLT is parsed reading
the URL source and used to create the javax.xml.transform.sax.TransformerHandler: to be more
clear
> [...]
> XSLTTransformer xsltTransformer = new
> XSLTTransformer(getClass().getResource("myXSLT.xsl"));
> Pipeline pipeline1 = new NonCachingPipeline();
> pipeline1.addComponent(new StringGenerator("<x><y/></x>"));
> pipeline1.addComponent(xsltTransformer);
> pipeline1.addComponent(new XMLSerializer());
> pipeline1.setup(System.out);
> pipeline1.execute();
> Pipeline pipeline2 = new NonCachingPipeline();
> pipeline2.addComponent(new StringGenerator("<z><w/></z>"));
> pipeline2.addComponent(xsltTransformer);  <========================== the URL pointed
by getClass().getResource("myXSLT.xsl") will be parsed again!!!
> pipeline2.addComponent(new XMLSerializer());
> pipeline2.setup(System.out);
> pipeline2.execute();
> As a quick solution we can store the Template to build the transformer handler objects
in a static hashmap, but in the future we should introduce stores.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message