Xquery Transformation with API and external variables
Oxygen general issues.
-
- Posts: 3
- Joined: Thu Dec 13, 2012 3:42 pm
Xquery Transformation with API and external variables
Hi!
I would like to transform a given XML-File using the oXygen-Api and a Xquery-file. The Xquery takes an external variable as parameter but I don't how (or even if) I can set this in java using the oxygen api. My variable $d ist supposed to contain the xml-file (or rather its path) to be processed. (I guess this corresponds to saxons -s switch).
Best regards,
bastian
I would like to transform a given XML-File using the oXygen-Api and a Xquery-file. The Xquery takes an external variable as parameter
Code: Select all
declare variable $d external;
Best regards,
bastian
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: Xquery Transformation with API and external variables
Post by alex_jitianu »
Hello,
You can create a transformer using Oxygen API through class ro.sync.exml.workspace.api.util.XMLUtilAccess. Getting access to an instance of the class depends if you are using plugin API or framework API. If you are using an workspace access plugin then you can get an instance using ro.sync.exml.workspace.api.PluginWorkspace.getXMLUtilAccess(). If you're using framework API then use ro.sync.ecss.extensions.api.AuthorAccess.getXMLUtilAccess(). To perform the transformation you can use something like this:
Best regards,
Alex
You can create a transformer using Oxygen API through class ro.sync.exml.workspace.api.util.XMLUtilAccess. Getting access to an instance of the class depends if you are using plugin API or framework API. If you are using an workspace access plugin then you can get an instance using ro.sync.exml.workspace.api.PluginWorkspace.getXMLUtilAccess(). If you're using framework API then use ro.sync.ecss.extensions.api.AuthorAccess.getXMLUtilAccess(). To perform the transformation you can use something like this:
Code: Select all
XMLUtilAccess xmlUtilAccess = authorAccess.getXMLUtilAccess();
try {
Transformer transformer = xmlUtilAccess.createXQueryTransformer(xquerySource, extensionJars, XMLUtilAccess.TRANSFORMER_SAXON_PROFESSIONAL_EDITION);
transformer.setParameter("d", pathToXMLFile);
Source xmlSource = new StreamSource(outputFileSystemID);
Result outputTarget = new StreamResult(outputFileSystemID);
transformer.transform(xmlSource, outputTarget);
} catch (TransformerConfigurationException e) {
e.printStackTrace();
}
Best regards,
Alex
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service