createXSLTTransformer with custom configuration
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
createXSLTTransformer with custom configuration
Hi,
I would like to change some transformer configurations for XsltOperations. I already implemented my own AuthorOperation-class for it and replaced the XMLUtilAccess.createXSLTTransformer() with the constrution of a saxon transformer. However, when running it, the messages and errors are not displayed in the oxygen output window and there might be more differences I did not notice yet. Is there a way for me to set up the transformer the same way as it is done inside XMLUtilAccess.createXSLTTransformer() - just with my customized configuration?
Thanks and regards,
Patrik
I would like to change some transformer configurations for XsltOperations. I already implemented my own AuthorOperation-class for it and replaced the XMLUtilAccess.createXSLTTransformer() with the constrution of a saxon transformer. However, when running it, the messages and errors are not displayed in the oxygen output window and there might be more differences I did not notice yet. Is there a way for me to set up the transformer the same way as it is done inside XMLUtilAccess.createXSLTTransformer() - just with my customized configuration?
Thanks and regards,
Patrik
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: createXSLTTransformer with custom configuration
Hi Patrik,
We don't have that.
How about if you first call our API to create the transformer and cast it to "net.sf.saxon.jaxp.TransformerImpl", then get the configuration from it net.sf.saxon.jaxp.IdentityTransformer.getConfiguration(), then create your own Saxon 9 transformer with that configuration changed in some way by you?
For example in the configuration for the XSLT transformer created by us you can find the net.sf.saxon.Configuration.getMessageEmitterClass() message emitter class which outputs to our messages view.
Regards,
Radu
We don't have that.
How about if you first call our API to create the transformer and cast it to "net.sf.saxon.jaxp.TransformerImpl", then get the configuration from it net.sf.saxon.jaxp.IdentityTransformer.getConfiguration(), then create your own Saxon 9 transformer with that configuration changed in some way by you?
For example in the configuration for the XSLT transformer created by us you can find the net.sf.saxon.Configuration.getMessageEmitterClass() message emitter class which outputs to our messages view.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
Re: createXSLTTransformer with custom configuration
Hi Radu,
sounds like a great workaround. Will try that...
Thanks,
Patrik
sounds like a great workaround. Will try that...
Thanks,
Patrik
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
Re: createXSLTTransformer with custom configuration
Hi Radu,
I implemented it now the way you suggested and it works fine. :)
Thanks again,
Patrik
I implemented it now the way you suggested and it works fine. :)
Thanks again,
Patrik
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: createXSLTTransformer with custom configuration
Hi Patrik,
Great.
One thing you could do would be that when you call XMLUtilAccess.createXSLTTransformer() you could avoid passing it your main XSLT (which may be quite large) because processing power would be spent to compiled it and afterwards its compiled version would be used for nothing. So you could pass it a very small stylesheet, just because later you will reuse only the configuration from this original transformer.
Regards,
Radu
Great.
One thing you could do would be that when you call XMLUtilAccess.createXSLTTransformer() you could avoid passing it your main XSLT (which may be quite large) because processing power would be spent to compiled it and afterwards its compiled version would be used for nothing. So you could pass it a very small stylesheet, just because later you will reuse only the configuration from this original transformer.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
Re: createXSLTTransformer with custom configuration
Hi Radu,
that's what I already did. Furthermore I store the baseCondifuration in a static variable to get it only once:
Regards,
Patrik
that's what I already did. Furthermore I store the baseCondifuration in a static variable to get it only once:
Code: Select all
if (baseConfiguration == null) {
final String dummyXsl = "<xsl:transform xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\"/>";
TransformerImpl temp = (TransformerImpl)authorAccess.getXMLUtilAccess().createXSLTTransformer(
new SAXSource(new org.xml.sax.InputSource(new StringReader(dummyXsl))),
null,
XMLUtilAccess.TRANSFORMER_SAXON_ENTERPRISE_EDITION,
false);
baseConfiguration = (EnterpriseConfiguration)temp.getConfiguration();
}
EnterpriseConfiguration configuration = baseConfiguration;
configuration.set...
[...]
TransformerFactoryImpl tf = new TransformerFactoryImpl(configuration);
t = tf.newTransformer(xslSrc);
Patrik
Return to “SDK-API, Frameworks - Document Types”
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