Saxon C parameters

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Saxon C parameters

Omkar Wagh
Hi

I'm using the saxon/c project and I'm having some trouble trying to figure out how parameters are intended to be handled.

I can see that I can create one instance of the SaxonProcessor class which creates multiple instances of the XsltProcessor class each of which can be used to compile a specific stylesheet. However, it's not clear how one might set different parameters to be passed to each compiled stylesheet since the parameters seem to be set in the SaxonProcessor and not in the XsltProcessor.

Is the recommended use case to create a new SaxonProcessor for every stylesheet we might want to use?
Regards,
Omkar

------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: Saxon C parameters

O'Neil Delpratt
Hi Omkar,

Thanks for contacting us regarding Saxon/C.

On 4 Aug 2015, at 20:06, Omkar Wagh <[hidden email]> wrote:

Hi

I'm using the saxon/c project and I'm having some trouble trying to figure out how parameters are intended to be handled.

I can see that I can create one instance of the SaxonProcessor class which creates multiple instances of the XsltProcessor class each of which can be used to compile a specific stylesheet. However, it's not clear how one might set different parameters to be passed to each compiled stylesheet since the parameters seem to be set in the SaxonProcessor and not in the XsltProcessor.

Currently setting the parameters on the SaxonProcessor or on the XsltProcessor makes no difference. They are global and shared across all xsltProcessors created. 

The question I ask myself is why was it designed this way?
I think the idea at the start in the alpha and beta releases XSLT processing was designed to be done using one shot methods for performance reasons. Therefore clearing the parameter between transforms was not a big deal. 

Thinking about it deeply as we are working on a new release of Saxon/C there are use cases here where setting parameters global only will throw up some problems. Therefore I will look into this.


Is the recommended use case to create a new SaxonProcessor for every stylesheet we might want to use?

No. Ideally you want to use the one SaxonProcessor and create several Xslt processors. If there are no conflicting issues between the stylesheets you could in fact reuse the same XsltProcessor which would help with performance. Although you will have to clear the parameters not needed between transforms.

Hope this helps.

kind regards,



-------------------------------
O'Neil Delpratt
Software Developer, Saxonica Limited 
Twitter: https://twitter.com/ond1
Tel: +44 118 946 5894
Web: http://www.saxonica.com
Saxonica Community site: http://dev.saxonica.com
Bug tracking site: https://saxonica.plan.io/




------------------------------------------------------------------------------

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help