Page 1 of 1

Transform Document in Author at runtime

Posted: Thu Jun 13, 2013 3:26 pm
by SSC
Hello,

is it somehow possible to do a XSL transformation of a document, which is currently shown in the oXygen Author?
I mean parse it at runtime and then directly show the result in the Editor?
So that die currently opened document is chanced, instead of creating a new document, which contains the transformation result.

Best regards,

Simon

Re: Transform Document in Author at runtime

Posted: Thu Jun 13, 2013 3:58 pm
by Radu
Hi Simon,

We have a publicly exposed operation called ro.sync.ecss.extensions.commons.operations.XSLTOperation which was intended to be used in a document type defined action in order to be applied on a certain node and replace it with the result of an XSLT transformation. You should find the Java sources for XSLTOperation in the Author SDK:

http://www.oxygenxml.com/oxygen_sdk.htm ... horing_SDK

So even if you might not use it directly you could get some inspiration from the Java code.

As an alternative if you want to apply the XSLT over the entire document we also have API like:

ro.sync.exml.workspace.api.editor.WSEditorBase.createContentReader()

and:

ro.sync.exml.workspace.api.editor.WSEditorBase.reloadContent(Reader, boolean)

So you could create a reader over the entire content, use our API to create an XSLT transformer:

authorAccess.getXMLUtilAccess().createXSLTTransformer(xslSrc, null, AuthorXMLUtilAccess.TRANSFORMER_SAXON_PROFESSIONAL_EDITION);

transform and then get the XML and reload it back in the editor.

Regards,
Radu