Appendix A. Transformations in Oxygen
To transform a XML file in the Oxygen application, you need to create a transformation scenario.
If you have not transformed any files yet, there will probably be no scenario available. In this case, you need to create one first. Follow these steps :
-
Click on the "Configure Transformation Scenario" button. It has an icon with a spanner and a small red triangle (see image on the right).
- In the window that pops up, click on "New". Another window appears.
In the top of the new window, you can see a text field in which you can
enter a name for the scenario that you are about to create. Type, for
instance, "Transformation1". This is the name that will appear in the
"Configure Transformation Scenario"-window. This window contains three
tabs :
- Click on the tab which is marked "XSLT". This screen contains a the text field which is labelled "XSLT URL", and here you can select the stylesheet that you want to use. Click on the "open"-button to navigate to your stylesheet. Note that you also have the option in this screen to select an XSLT-processor. The default processor is Saxon. For basic transformations, choosing a different processor will have very little to no effect on the outcome. It is only when you include a number of more advanced features of XSLT that you might begin to notice a few differences.
- The middle tab is used for transformations which use scripts that contain XSL:FO. As this is not the case for our current stylesheet, you can ignore this middle tab for now.
- The third (rightmost) tab allows you to name the output file. After "Save as", type in the name that you would like to give to your HTML-file (e.g. output.html). If you do not specifiy a path, Oxygen will automatically save the output in the same directory as the stylesheet and the XML-file. If you select the "Open in browser" option, Oxygen will load the result of the transformation in your Internet browser.
- Click on "OK" in the current window to switch back to the the underlying window (the "Configure Transformation Scenario"-window). Having checked that the scenario that you have just created appears in the list and that it is selected, click on "OK" to close this window.
If a scenario is available and if it has been configured correctly, you can execture the transformation by clicking on the "Apply Transformation"-button which is marked by a red arrow (see illustration). If the transformation is sucessful, an new html-file will have been created in the directory that you had specified.
Browser transformations
An XSLT-transformation can also be performed by a browser that supports XSL. This is the case for, for example, Firefox, and for Internet Explorer version 5 and higher. The Microsoft XSLT implementation is called MSXSL.To transform the file, add a link in the XML file to the XSLT-file, immediately after the XML-declaration :
<?xml-stylesheet type="text/xsl" href="stylesheet.xsl"?>
If you open the xml-file in a browser that supports XSL, you will see not the full XML file, but a representation of this file based on the specifications in the stylesheet transformation.xsl.