This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Setup recommended course tools [May 13, 2012, 12:21 p.m.]


We want to have very simple ways for folks to get xslt tools set up so that it is easy to start testing things out. Please review the following and make any additions and clarifications. As each of use gets tools set up, it would be nice to flesh out the instructions for which ever operating system and tools we are using.

Tools Basics

Texteditor of your choice

For getting started with XSLT we first need a good text editor. You can use a texteditor of your choice, but I suggest using an editor which supports:

  • XML syntax highlighting.
  • Autoclosing XML-tags. It helps you alot when you're writing XML and XSLT (I will explain later what XML tags are if you do not know it yet).
  • supports and displays unicode encoded (UTF-8) XML in the right way .

 

Few recommendations for editors

Here are just a few recommendations which support all needed preconditions out of the box:

Linux

  • Geany
    install on Ubuntu with: sudo apt-get install geany
  • Eclipse
    I recommend to download the latest Eclipse Classic or Java from http://www.eclipse.org/downloads/ and unpack it to the directory of your choice. You can run it directly without any installation.
  • vi or Emacs
    I'm pretty sure vi or Emacs also supports our preconditions but do not ask me how to configure them ;)

 

Windows

 

XSLT processors

A XSLT processor is the heart of a XSL transformation. It transforms XML to XML, text or even to images or Word files or PDFs. (more explanation here needed)

We will concentrate on two opensourced and most used XSLT processors for the commandline. One, xsltproc from libxslt, is a XSLT 1.0 processor and the second one, Saxon-B, is a XSLT 2.0 processor.

xsltproc from libxslt

Linux

If you're using Linux, chances are pretty big that you already have xsltproc installed. Try to run it with

xsltproc --version 

Otherwise install it with your package manager.

Windows

For Windows I recommend to download all libxml2 binaries from http://www.zlatkovic.com/libxml.en.html to a directory of your choice and to add them into your PATH.

Windows and Linux

Commandline usage example for xsltproc:
xsltproc -o output.xml stylesheet.xsl input.xml

Saxon-B from Saxonica / Michael Kay

Linux

Install it with your package manager.
Instructions for Ubuntu:
sudo apt-get install libsaxonb-java

Commandline usage example for Saxon-B in Linux:
saxonb-xslt -s:source.xml -xsl:style.xsl -o:output.xml

Windows

The last release of Saxon-B was version 9.1.0.8. Do not use Saxon HE even if it has a higher version number. Saxon-B has more functionality than Saxon HE.

Download it from here. You also need java installed.

For the future projects I recommend to have a copy of saxon9.jar in the same directory were you make your XSL transformations.

Commandline usage example for Saxon-B in Windows:
java -jar saxon9.jar -s:source.xml -xsl:style.xsl -o:output.xml

Additional XML related tools

This tools are optional and not needed at first. But if you want to transform complex XML you probably need them or tools which are equivalent.

  • xmllint is a xml validation tool from libxml2. It is part of libxml2 and already installed on many Linux systems. When you use Windows install the same way as xsltproc. It is very useful to check if a XML file is valid XML (a XML can get invalid sometimes, often by mistake after editing it)
    Command for checking for valid XML:
    xmllint --noout input.xml
  • XML Marker 1.1 is a free Windows tool which I also use under Linux with WINE. It shows the tree structure of XML files and is very useful for analysing XML and developing XSLT. It also checks if a XML is a valid XML structure like xmllint.
  • Eclipse is a opensource alternative to XML Marker if you want to analyse the tree structure and nesting of a XML.