A copy of the library is included in the directory path_ology. The three sub-directories contain:

  • library: the set of XSLT transformations and the files saxon6.jar and saxon9.jar which contain the Saxon implementations of XSLT 1.0 and XSLT 2.0. Both versions of XSLT are used in the library transformations
  • temp: this contains the intermediate files generated in a multi-stage transform. Using this directory means that the files get overwritten by the next use of the library and thus stops the build up of such files.
  • examples: a set of subdirectories that demonstrate the usage of each transformation in the library. Clicking on the .bat files will perform the transformations and generate the result file. It is sensible to copy the library to local storage before testing it out. More efficient ways of providing an environment to run the transformations is possible. This simple sequence of batch transformations makes the stages very visible and allows access to the intermediate temporary files.

A typical .bat file in one of the examples subdirectories would have the form:

java -jar ../../library/saxon6.jar  -o ../../temp/t1.xml  test.svg            ../../library/break_path.xsl
java -jar ../../library/saxon6.jar  -o ../../temp/t2.xml  ../../temp/t1.xml   ../../library/make_abs.xsl
java -jar ../../library/saxon9.jar  -t ../../temp/t2.xml   ../../library/add_subpath.xsl >  ../../temp/t3.xml
java -jar ../../library/saxon6.jar  -o ../../temp/t4.xml  ../../temp/t3.xml   ../../library/make_xml.xsl
java -jar ../../library/saxon6.jar  -o ../../temp/t5.xml  ../../temp/t4.xml   ../../library/change_accuracy.xsl decplaces=1
java -jar ../../library/saxon6.jar  -o testreldec1.svg    ../../temp/t5.xml   ../../library/back_to_svg.xsl mode=rel

Clearly the path descriptions will change if the file to be transformed is at a different position in the hierarchy relative to the library.

Each stage applies an XSLT transformation to an XML file to generate another XML file. For example the first transformation takes an SVG file (which is an application of XML) and performs the transformation break_path.xsl to generate the temporary file t1.xml in the temp directory.

XSLT assumes the the file to be transformed is in the default namespace. In consequence, remove the SVG namespace declaration from the svg file before applying the transformations.

More details of the various transformations are given on other pages. The first four transformations convert the SVG file to its internal form t4.xsl. Note that the position of the output file is defined somewhat differently in the XSLT 2.0 transformation using Saxon Version 9.

The fifth transformation changes the accuracy of the coordinates in the internal XML format. Note the transformation has a parameter decplaces=1 which defines the number of decimal places in the resulting file.

The last transformation returns the file generated, t5.xml, back to the SVG file testreldec1.svg. The parameter mode=rel indicates that the final path descriptions will be in relative form with a single decimal place of accuracy.

Any number of transformations can be applied between the four that generates the internal XML form and the final one that returns the file to an SVG form.