Cocoon 3
  1. Cocoon 3
  2. COCOON3-6

The org.apache.cocoon.pipeline.component.sax.XSLTTransformer can be optimized

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha-2
    • Fix Version/s: 3.0.0-alpha-2
    • Component/s: cocoon-sax
    • Labels:
      None

      Description

      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.
      1. XSLTTransformerOptimization.patch
        8 kB
        Simone Tripodi
      2. OptimizedXSLT+xsltcTransformer.patch
        20 kB
        Simone Tripodi

        Activity

        Simone Tripodi created issue -
        Simone Tripodi made changes -
        Field Original Value New Value
        Attachment XSLTTransformerOptimization.patch [ 12392660 ]
        Simone Tripodi made changes -
        Component/s cocoon-pipeline [ 12312489 ]
        Component/s cocoon-sax [ 12312641 ]
        Simone Tripodi made changes -
        Attachment OptimizedXSLT+xsltcTransformer.patch [ 12406894 ]
        Reinhard Poetz made changes -
        Assignee Cocoon Developers Team [ cocoon ] Reinhard Poetz [ reinhard@apache.org ]
        Reinhard Poetz made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Reinhard Poetz
            Reporter:
            Simone Tripodi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development