GXS AI: Tutorial, lesson 4

Testing the map

  1. Save the map.
  2. Select Test->Translate in the top menu.

  3. In the opened window enter the following values, clicking “Add” every time you add a new pair:
    • Variable Name: S_MODEL, Variable Value: D:\Trandev\models\example01\example01S.mdl
    • T_MODEL, D:\Trandev\models\example01\example01T.mdl
    • INPUT_FILE D:\Trandev\models\example01\TestData\in.txt
    • OUTPUT_FILE D:\Trandev\models\example01\TestData\out.txt


  4. Continue reading

GXS AI: Tutorial, lesson 3

Creating the simple links

Now, when both source and target models are ready, we can continue.

We’ll start with the “simple links” – very, well, primitive 🙂 technique, which “explains” to the translator how to create the target document using the source data. Usually, the simple links are used in very simple cases – when the target structure is similar to the source.

Our example is pretty obvious – the data from Line Item ID, Quantity, Unit Price and Exp. Date from the source document go into appropriate fields of the target one. Both structures are almost the same – repeatable records of the same type. So, the simplest solution here is to use the simple links.

To create the simple rules, open the map, select the first field for linking – LineItemID, leftclick on it and holding the button move the pointer to the target LineItemID (drag and drop). You’ll see a blue line connecting both elements (see below). This line means that the data from the source’s LineItemID will go to the target’s LineItemID.

Continue reading

How to “debug” XSLTs

I don’t use any specific tool to test and debug XSLT files. In 90%+ cases the problem is with the XPath and I need to find the exact place where it becomes wrong. So, I use the “count()” function and (sometimes) xsl:comment, like this:

<xsl:comment>
	-<xsl:value-of select="count(aaa)"/>
	-<xsl:value-of select="count(aaa/bbb)"/>
	-<xsl:value-of select="count(aaa/bbb/ccc)"/>
	-<xsl:value-of select="count(aaa/bbb/ccc[@ddd = 'eee'])"/>
</xsl:comment>

If I see something like

<!--
  -1
  -1
  -3
  -0
-->

in the output, it’s clear that the problem with the XPath condition in the brackets.

Gennady Kim

GXS AI: Tutorial, lesson 2

Now we need to create the source and target structures – the translator will use them for parsing the input and generating the output documents.
I’ll show you how to describe the source structure and you’ll be able to create the target yourself. Let’s start:

  1. Select the “Document” element on the left (source) side.
  2. In the top menu select Model->Insert Item->Below
  3. On the “DMI Attribute” tab change the following parameters:
    1. Name = LIN
    2. Access Type = LineFeedDelimRecord. So, now it’s not a group but a record.
    3. Min/Max = 1/100. They are the minimum and maximum of repetitions.
    4. Match Value = LIN. It’s a very important parameter – the translator uses it to recognize the LIN records in the source document.

    5. Continue reading