Transform Document in Author at runtime

Oxygen general issues.
SSC
Posts: 206
Joined: Thu Dec 01, 2011 4:22 pm
Location: Hamburg, Germany

Transform Document in Author at runtime

Post 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
Simon Scholz
vogella GmbH
http://www.vogella.com
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Transform Document in Author at runtime

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply