ITS Translate Decorator

From ITS
Jump to: navigation, search

ITS Translate Decorator


The ITS Translate Decorator is an XSLT-based ITS processor which decorates an input document with information for the ITS Translate data category. The ITS Translate Decorator is very simple and is targeting people who are either new to ITS and need an easy introduction to ITS processing, or in need of a component for a more comprehensive processor (e.g. an ITS-based converter to the XML Localization Interchange File Format).

The XSLT-based "decoration" approach was pioneered by Spritser, a general ITS 1.0 implementation provided by Sebastian Rahtz (Oxford University).


The ITS Translate Decorator is realized by means of an XSLT-based processing chain:

  • Generation of intermediate stylesheet based on input (including ITS information)
  • Decoration of input by means of intermediate stylesheet

Batch scripts can easily string these process steps together.

The output is the same document as the input, with the following additional information:

  • For each element node there is an itsTve attribute with the value "yes" (element content is translatable) or "no" (element content is not translatable).
  • If there are translatable attributes at an element node, that node has an itsTva attribute which lists the names of these attributes, seperated by '#'. Attributes whose name is not listed as part of itsTva are not translatable.

Example input and output

An example input document looks like this:

<x a="y" xmlns:its="" version="1.0">
    <its:translateRule selector="//@alt" translate="yes"/>
    <its:translateRule selector="//u/@alt" translate="no"/>
  <b its:translate="no" alt="b">
      <u a="r" alt="j" its:translate="yes">

After the processing chain, the output looks like below. Markup expressing ITS "Translate" information is in bold. The values "yes" and "no" are taking from the "Translate" data category.

<x xmlns:its="" itsTve="yes" a="y" 
   <its:rules itsTve="yes">
      <its:translateRule itsTve="yes"
       selector="//@alt" translate="yes"/>
      <its:translateRule itsTve="yes"
 selector="//u/@alt" translate="no"/>
   <b itsTva="#alt#" itsTve="no" its:translate="no" alt="b">
      <x itsTve="no">
         <u itsTve="yes" a="r" alt="j"


Main (as ZIP file):

  • version 0.1 (2008-06-24) is specific to the Saxon processor and relies on XSLT 2.0.
  • version 0.2 (2008-08-14) is implemented in XSLT 1.0 and comes with batch files for altovaxml, msxsl and saxon. NOTE: to run these batch files you need to adjust the path to your processor in the batch files.
  • latest version link (content is the same as version 0.2)

Batch scripts:

The following are driver scripts for running the ITS Translate Decorator using bash. They have been tested on Mac OS X and Debian GNU/Linux.