Run XSLT or XQuery Transformations
Question
Can I run XSL 2.0 / 3.0 transformation with Saxon EE using the oXygen SDK?
Answer
The API class ro.sync.exml.workspace.api.util.XMLUtilAccess
allows you
to create an XSLT Transformer that implements the JAXP interface
javax.xml.transform.Transformer
. Then this type of transformer can be
used to transform XML. Here's just an example of transforming when you have an
AuthorAccess
API available:
InputSource is = new org.xml.sax.InputSource (URLUtil.correct(new File("test/personal.xsl")).toString()); xslSrc = new SAXSource(is); javax.xml.transform.Transformer transformer = authorAccess.getXMLUtilAccess().createXSLTTransformer (xslSrc, null, AuthorXMLUtilAccess.TRANSFORMER_SAXON_ENTERPRISE_EDITION); transformer.transform(new StreamSource(new File("test/personal.xml")), new StreamResult(new File("test/personal.html")));If you want to create the transformer from the plugins side, you can use this method instead:
ro.sync.exml.workspace.api.PluginWorkspace.getXMLUtilAccess()
.