I'm working on addition internationalization to my XSL. I've seen plenty of examples of creating a dictionary.xml file and loading it into my XSL via document('dictionary.xml'). I want to do something similar, but I don't want to create and store the dictionary.xml file on disk, I'd rather build it from SQL at server startup and keep the Document object in memory in Java. I'd like to then pass the dictionary document as a parameter to the transformer so that my XSL translation function can use it. However, it doesn't seem to be working.
Relevant Java code:
Document dictionary = TranslationDictionary.getDictionaryDocument();
transformer.setParameter("dictionary", dictionary);
The dictionary document content:
<dictionary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<translatedString dictionaryId="BASIC_DETAILS">
<language id="es" value="Detalles Básicos"/>
</translatedString >
<translatedString dictionaryId="VEHICLE_INFORMATION">
<language id="es" value="Información del Vehículo"/>
</translatedString >
<translatedString dictionaryId="STRUCTURE">
<language id="es" value="Estructura"/>
</translatedString >
<translatedString dictionaryId="DRIVER_INFORMATION">
<language id="es" value="Información del Conductor"/>
</translatedString >
<translatedString dictionaryId="MAINTENANCE_AND_FEUL">
<language id="es" value="Mantenimiento & Combustible"/>
</translatedString >
<translatedString dictionaryId="PURCHASING">
<language id="es" value="Compra"/>
</translatedString >
</dictionary>
The XSL file:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://www.test.com">
<xsl:param name="dictionary"/>
<xsl:param name="language" select="'es'"/>
<xsl:template match="/">
<xsl:message>
<xsl:copy-of select="$dictionary/dictionary/translatedString[@dictionaryId='BASIC_DETAILS']/language[@id='es']/@value"/>
</xsl:message>
</xsl:template>
But I get nothing. I've tried just doing a copy of $document/document to confirm that I'm not having an xpath issue, and its not that, because that gives me a copy of the full document. It's as if the XSL is seeing $dictionary as a string instead of a node. Any clues?