Is it possible to programmatically run XSLT transformations in CQ from withing a sling JSP component?
When i try, i get stuck while trying to get a javax.xml.transform.Transformer instance from my xsl
The xsl seems to get compiled correctly "Translet class loaded..." but not correctly available "... but unable to create translet instance."
This is happening on versions: CQ 5.4, CQ 5.5, CQ 5.6 also on standard local crx-quickstart versions
Can be reproduced like this:
- Setup a sling component (simple jsp) for rendering an XSLT transformation
- import a (previously tested) xslt stylesheet
- get the jcr document view XML of the requested resource (resp. corresponding jcr subgraph)
like: ses.exportDocumentView(path, xmlbos, false, false); - get the xsl stylesheet
like: component.getLocalResource("out/dv.xsl/jcr:content").adaptTo(Node.class).getProperty("jcr :data").getBinary(); - get a javax.xml.transform.TransformerFactory
like: TransformerFactory xffac = TransformerFactory.newInstance(); - try to get a javax.xml.transform.Transformer providing the previous stylesheet
like: Transformer xfer = xffac.newTransformer([ABOVE_BINARY].getStream()); - > this wan't work! and throw the following error: "Translet class loaded, but unable to create translet instance."
Although i was able to verify correct reading of the XML and the XSL data as well as correct compilation of the XSL...
Am i missing something? Is there some special cq built-in behaviour that should be used instead? Or some configuration on the TransformerFactory that has to be applied?
Many thanks for any help on this!
Regards
Paolo Tognola