Compiling an XSL Stylesheet for SaxonEdit online
As of Saxon 9.7, it is possible to export a compiled form of a stylesheet as an XML file (called a stylesheet export file or SEF). Oxygen XML Editor plugin includes a simple tool called Compile XSL Stylesheet for Saxon (found in the XML Tools menu) that does this for you.
Use-Cases for a Stylesheet Export File (SEF)
- Use Saxon-JS to run transformations in a browser - A stylesheet export
file (SEF) is needed if you want to use the Saxon-JS product to run transformations in a browser, as in the
following
example:
<script type="text/javascript" src="SaxonJS/SaxonJS.min.js"></script> <script> window.onload = function() { SaxonJS.transform({ stylesheetLocation: "books.sef", sourceLocation: "books.xml" }); } </script>
- Use SEF to run transformations in Oxygen XML Editor plugin - You can also use a stylesheet export file (SEF) in Oxygen XML Editor plugin to apply an XSLT transformation over an XML file. This requires Saxon-EE or Saxon-PE versions of the Saxon product and you must select one of those two versions for the Target when you configure the SEF file. When configuring the XSLT transformation, you will specify the SEF file in the XSL URL field.
Compiling an SEF File
The Compile XSL Stylesheet for Saxon tool can be found in the
XML Tools menu and it compiles a
specified stylesheet as an XML file (stylesheet export file with a file extension of
.sef).
Selecting this tool opens the Compile XSL Stylesheet for Saxon dialog box that allows you to configure some options for conversion.
This dialog box includes the following options:
- XSL URL
- Allows you to select URL of the source XSL stylesheet. You can specify the URL by
using the text field, the history drop-down, or the browsing actions in the
Browse drop-down list. - Target
- Allows you to select the type of Saxon product that the export file will be used with. You can choose Saxon-JS, Saxon-EE, Saxon-PE, or Saxon-HE.
- Relocatable
- Can be used to control the Saxon
-relocateparameter. You can select this option to produce a relocatable export package (SEF) that can be deployed to a different location, with a different base URI. - Output file
- You can specify the path where the output file will be saved by entering it in the
text field, using the
Insert Editor Variables button, or using the
browsing tool buttons (
). - Convert
- Use this button to generate the stylesheet export file according the options selected in this dialog box.