问题
I have generated an XSLT stylesheet which converts an XML file to an ePub. I use saxon9.jar to convert the XML using XSLT. Now I need to know whether I can make the XSLT code binary. Is it possible using java, so that I can generate a jar file which converts the XML to ePub using saxon, provided that the content of XSLT file is not readable.
回答1:
The problem got resolved after I read this page: http://saxon.sourceforge.net/saxon7.6/using-xsl.html#Compiling
回答2:
One possibility would be to use Xalan-J XSLTC - https://xml.apache.org/xalan-j/xsltc_usage.html. Of course this is a different XSLT engine than Saxon ... and it appears that Xalan-J only supports XSLT-1.0 / XPATH-1.0.
I'm not sure, but it appears that Saxon-EE supports compilation of stylesheets to bytecode. Saxon-EE not a free product though.
回答3:
If you want to obfuscate a stylesheet with Saxon you need the EE or PE edition, see http://www.saxonica.com/documentation/index.html#!using-xsl/packaged-xslt, to create the obfuscated stylesheet. You can then run it however with Saxon HE.
来源:https://stackoverflow.com/questions/18919835/how-to-encode-data-of-xslt-stylesheet