Section - 4 : Triggering Forms and Images


You can do simple triggering based upon the existence of a node. For example, this

/child::car

would trigger a form if car is a child of the root node. Referring back to the earlier example, you could make it trigger two of the same forms because there are two cars.

The system supports value matching. So you can do the following:

/child::car[child::driver="Tom"]

Or, you can use the RecipIf rule to trigger an image with custom rule parameters, as shown in this example:

A={!/child::car/child::driver 1,7}::if (A='Tom')::return("^1^")::end::;

If there is such a value in that element in the XML file, the image would trigger. For this to work, define the offset of the variable attribute as 1 and the length of the data you want to compare.

You can also use XML search strings such as these:

This string Finds
!descendant::PolicyNumber The PolicyNumber value
!descendant::Forms/child::Form All forms

Using the ElementText option

Note that when the XPath specifies an element node such as

//BookStore/Book

it returns the element handle and either its element text or its first attribute value if there is no element text. If you want to use this to map a field, you can use the ElementText INI option to better control what XPath returns. For instance, here is an excerpt from an XML file:

...

< BookStore >

< Book Category = "Fiction"> </Book>

...

Since there is no text for the element/node Book in this excerpt, this XPath statement returns the first attribute value, which equals Fiction.

//BookStore/Book

With the ElementText option set to Yes, which is the default, nothing is returned. If you set this option to No, the first attribute is returned. Here is an example of the ElementText option:

< XPath >

ElementText = Yes