ONIX tagname converter

The ONIX tagname converters 'switch-onix-tagnames-1.1.xsl' and 'switch-onix-tagnames-2.0.xsl' are XSLT scripts that replace reference tagnames with short tagnames and vice versa. They works for all valid ONIX files, including all Releases up to and including Release 2.1 that are supported on the EDItEUR website.

These two scripts are functionally equivalent, but use different versions of the XSLT scripting language to achieve the same results.

WARNING! It is essential that the correct script is used! Please check which XSLT engine you are going to use and which version of XSLT that this engine uses before installing the correct version of the ONIX tagname converter!


The ONIX tagname converter is provided 'as is' and is not warranted in any way by EDItEUR. EDItEUR provides no technical support for this tool other than this document. EDItEUR disclaims all responsibility for any errors and for all consequential inconvenience or cost associated with its use. All bug reports and other enquiries should be referred to the author, whose contact details at the end of this document.

1. Preparation and installation

You must first decide which of the two versions of the ONIX tagname converter script you need to use. This will depend upon which version of XSLT is supported by your chosen XSLT engine.

To run the script it is necessary first to choose and install an XSLT 'engine'. Suitable engines include Saxon and Xalan. Saxon is obtainable from http://saxon.sourceforge.net/. Xalan is obtainable from http://xml.apache.org/. Various versions are available. If in doubt, choose an engine that is described as 'stable', such as Saxon version 6.5.5, Saxon-B version or Saxon version 9.2 HE.

The script 'switch-onix-tagnames-1.1.xsl' relies upon some Saxon XSLT 1.1 extensions. There is a stand-alone executable version of Saxon for pre-XP versions of Microsoft Windows, called Instant Saxon, but this requires the Microsoft Java Virtual Machine, which is no longer available for Windows XP. The best solution is to install the Sun Java 2 Virtual Machine (available from http://java.sun.com/) and run the version of Saxon (preferably version 6.5.5) or Xalan that is available for the Java 2 platform.

The alternative version of the script, 'switch-onix-tagnames-2.0.xsl' relies upon some XSLT 2.0 functionality, and this can be used with Saxon version 8.7.1 or later.

The script will only work if the ONIX file that is to be converted is DTD VALID, i.e. either it contains a DTD Declaration that links to a master version of the ONIX DTD (on the EDItEUR website), or it has been normalised to include all fixed attributes explicitly by pre-processing by a suitable XML parser, and it doesn't contain any tag errors. It is possible to convert ONIX files that link to local copies of the DTD, but the converted file will link to a master version of the DTD on the EDItEUR website.

Note that it is NOT currently possible to convert ONIX files that link to the ONIX XML Schema and there are no current plans to make this possible, as it would necessitate using commercial XSLT engines that are not freely available.

The XSLT script should be placed in a convenient directory/folder.

2. Running the script

The precise method of running the script will depend upon the version of the script, the XSLT engine and other associated software tools being used.

In the case of 'switch-onix-tagnames-1.1.xsl' there are no parameters that need to be set. A typical invocation using Saxon 6.5.5 and the Sun Java 2 Virtual Machine, for example, would be:

java -jar saxon.jar original-onix.xml switch-onix-tagnames-1.1.xsl > converted-onix.xml

or alternatively:

java -jar saxon.jar -o converted-onix.xml original-onix.xml switch-onix-tagnames-1.1.xsl

In the case of 'switch-onix-tagnames-2.0.xsl' there is a parameter that needs to be set. A typical invocation using Saxon 8.7.1 and the Sun Java 2 Virtual Machine, for example, would be:

java -jar saxon8.jar original-onix.xml switch-onix-tagnames-2.0.xsl result-document="converted-onix.xml"

3. Bug reports and enquiries

To report bugs and to make all other enquiries please contact Francis Cave (francis@franciscave.com) by email only.