Search code examples
xmlxsltlocalizationaltova

Altova StyleVision Localization


I am using Altova Stylevision 2011 Enterprise to generate an XSLT file, that is used to generate a report based on some XML data. I am looking for a way to add localization.

I would like to have a tag in the XML, like <language>en</language> and then have the XSLT to choose from a specific set of strings for, e.g. a heading, based on that value.

Any ideas how to implement this in the StyleVision SPS file?

I don't like the idea to have a number of SPS files (each for one language) with localized static texts, because then we have to update all of these files when the design changes...

Thanks for your feedback!


Solution

  • I feel stupid... thanks to Mark Veenstra for his comment, that pointed me to the obvious answer :-)

    There is indeed an example project Multiple Languages that offers several ways to solve my problem. Case closed - almost.

    It's working now in the StyleVision user interface, I chose the second input file approach. But now I am having troubles to generate the report on the command line via the AltovaXML.exe tool. How to specifiy the second input file (my XML File containig the translations) to the processor? It seems only one input file is recognized via the -in parameter. In the generated XSLT I see

    <xsl:variable name="Translation" select="document($Translation)"/>
    

    which matches the name of the translation XML in the sources tab of the UI, and

    <xsl:value-of-select="$Translation/id("TITLE")/Translation[@Language=$XML/data/language]"/>
    

    where a to be translated text is matched. The target language is referenced in $XML/data/language.

    When I do

    AltovaXML.exe -xslt2 Report.xslt -in Data.xml -out Report.fo
    

    Nothing is being output for the to be translated strings and no error message is produced...

    What am I missing now?

    Again - found the solution: AltovaXML needs the second input file as a parameter: adding -param Translation='Localization.xml' did the trick. Case closed - this time for real.