Transformation

C3 can also transform data before it's placed in the document. In a normal case the data should be prepared for the publication, but for some reasons there might be a case where the data must be transformed in some way. Transformations are defined in a settings file called C3.xml

Languages

The language control makes it possible to set the InDesign language on text placed in the document. This makes the dictionary and spell check settings work better. In C3.xml you set up the mapping list between data and InDesign languages.

  • lang = The language code in the data.
  • locale = InDesign language code
  • name = Name of the language

Transform data

The transformation works like a search and replace. The transformation are made after data is read and before it is placed in the document. C3 can search for a text or a pattern and change this. Examples of transformations:

  • Replace , to . in numbers.
  • Add currency like € or $.
  • Format item numbers eg. 12345 to 123-45

The transformation setting is stored in C3.xml and this file can be found in Adobe InDesign program folder. The following parameters are used:

  • The element and a possible condition: query match.
  • A transformation rule: rule
  • The text or pattern to look for: findstring.
  • What to chage to: replacestring.
  • Multiple query can be added within querys They are performed in order.

Search and replace patterns are defined as Regular Expressions. The reference to elements and conditions is defined with xPath.

Exemple C3.xml

<c3>
    <!-- each language maps a C3 lang with an InDesign locale.
            If not defined, match will be made automatically against all InDesign locales until a match is found,
            ignoring - _ and upper/lowercase -->
    <languages>
        <language>
            <name>American</name>
            <lang>US</lang>
            <locale>en_US/locale>
        </language>
        <language>
            <name>Swedish</name>
            <lang>SE</lang>
            <locale>sv_SE/locale>
        </language>
    </languages>

    <!-- Example querys -->
    <querys>
        <!-- All "name" -->
        <query match="name">
            <rule>
                <findstring>Product</findstring>
                <replacestring>PROD</replacestring>
            </rule>
        </query>

        <!-- Only product "name" -->
        <query match="product > name">
            <rule>
                <findstring>One</findstring>
                <replacestring>ONE</replacestring>
            </rule>
        </query>

        <query match="product[lang='EN'] > name">
            <rule>
                <findstring>(.+)$</findstring>
                <replacestring>$1\u0160English</replacestring>
            </rule>
        </query>
    </querys>
</c3>

results matching ""

    No results matching ""