Maintenance: Planio will be observing a scheduled maintenance window this Sunday, November 10, 2024 from 20:00 UTC until 21:00 UTC to perform important network maintenance in our primary data center. Your Planio account will be unavailable for a few minutes during this maintenance window.
PreparedStylesheet handling when upgrading from 9 to 11
Added by Wads Onkon almost 2 years ago
Hello, I am upgrading from saxon 9 to saxon 11 and ran into issue:
I have PreparedStylesheet which is saved in file that used to be loaded via: PreparedStylesheet.loadCompiledStylesheet Then parameters are set and transformed result is saved into file: s.newTransformer(); transformer.setParameter.. transformer.transform(... (also using MessageEmitter that changed considerably too to log transformation details)
From what I have gathered from forum (topic 8025) and digging via examples/source it seems to be not advised anymore.
Is there any way I could make this work given that I can not get stylesheet used to create original PreparedStylesheet (legacy system...)?
Replies (8)
Please register to reply
RE: PreparedStylesheet handling when upgrading from 9 to 11 - Added by Michael Kay almost 2 years ago
The ability to save and reload a stylesheet using Java serialisation (i.e PreparedStylesheet.loadCompiledStylesheet
) was dropped in Saxon 9.4, released in December 2011. The modern replacement is the ability to export to a SEF file.
In the old mechanism, the saved format was very closely tied to Saxon internal classes and properties, so in general it wasn't possible to save a stylesheet under one Saxon release, and reload it under a later release.
I'm afraid there's no reverse compiler, so if you've lost the XSLT source code I don't think there's any practical way of recovering it.
RE: PreparedStylesheet handling when upgrading from 9 to 11 - Added by Wads Onkon almost 2 years ago
Thank you.
Is there a documentation page about generating/loading SEF file?
RE: PreparedStylesheet handling when upgrading from 9 to 11 - Added by Wads Onkon almost 2 years ago
After some more digging I found actual stylesheets and they were being built using net.sf.saxon.Compile in ant job. I presume generating SEF file will be similar?
RE: PreparedStylesheet handling when upgrading from 9 to 11 - Added by Michael Kay almost 2 years ago
You can generate SEF files either using the -export option on the Transform command line (plus -nogo if you don't want to execute), or using methods in the s9api API.
RE: PreparedStylesheet handling when upgrading from 9 to 11 - Added by Wads Onkon almost 2 years ago
"Exporting a stylesheet requires Saxon-EE" I presume there is no third way to achieve what I am doing?
RE: PreparedStylesheet handling when upgrading from 9 to 11 - Added by Michael Kay almost 2 years ago
The third way is simply to recompile the stylesheet each time. It's not actually that much more expensive than reloading it from a SEF file.
RE: PreparedStylesheet handling when upgrading from 9 to 11 - Added by Wads Onkon almost 2 years ago
Yes, but that means we either loose encryption we had on PreparedStylesheet, or have to make something really complex to encrypt whole folder of stylesheets to load them later.
RE: PreparedStylesheet handling when upgrading from 9 to 11 - Added by Michael Kay almost 2 years ago
I'd call it obfuscation rather than encryption - but yes, its true that both the old and new methods of precompiling stylesheets have benefits in protecting your IP as well as performance considerations.
Sorry if the feature is valuable to you but not valuable enough to justify the cost of an EE license. Remember you only need an EE license to generate a SEF file, not to load one.
Please register to reply