Software & Development

Xalan Xsl and Lookup tables

If you don’t know what is a lookup table in context of Xsl transformation you might like these short example articles here or here

The common way to use lookup tables in Xsl transformations is to use select=”document(”)/*/data/” syntax. If there is no path provided and the parameter of document() function is string, the function returns the reference to the stylesheet itself. However, this is not true for all Xsl transformation libraries.

In case you use Xalan and the document is loaded from database, you might get into trouble – the function will not find anything. The workaround is to load a different Xml document by calling document(‘data.xml’). Yes, there’s a but too. Xalan will look for the document in the java application startup path, not in the same location as the Xsl stylesheet, nor in the path of Xml document being transformed (it is in database, you remember, right?). In case your application is a web application running in Apache, the startup path is apache/bin