Creating an XMLIN configuration > Managing patterns, blocks, and fields > Fields > Mapping XML nodes to fields in the XMLIN configuration

Mapping XML nodes to fields in the XMLIN configuration
You use XSLT Patterns as match criteria to map nodes in the XML input document to fields in the XMLIN configuration. A match criterion describes the path to the node and, if required, additional conditions. XPath expressions define which value to add to the field.
Before you start mapping nodes to fields, you can edit the default match criteria suggested by the XMLIN tool. See Default match criteria for fields and patterns.
To map XML nodes to fields
1
2
In the Match field, enter the XSLT Pattern. You can use all valid XSLT Patterns. See www.w3.org/TR/xslt.
3
In the Value field, enter the XPath expression. You can use all valid XPath expressions. See www.w3.org/TR/xpath.
Match criteria examples
These examples have the following XML input:
<?xml version="1.0"?>
  <music>List
    <CD>Classic
        <Composer type="western">Brahms</Composer>
        <Composer type="western">Grieg</Composer>
    </CD>
   <CD>Classic
        <Composer type="eastern">Quing Mao</Composer>
        <Composer type="eastern">Han Zuy</Composer>
    </CD>
 </music>
Example 12
The match criterion is specified as “CD/Composer”. There will be a match for all <Composer> nodes in the input.
 
Example 13
The match criterion is specified as “CD/Composer[2]”. There will be a match for the second <Composer> node below each <CD> node.
 
Example 14
The match criterion is specified as CD/Composer[@type=’eastern’]. There will be a match for all <Composer> nodes with attribute type="eastern".
 
Field value examples
These examples have the following XML input:
<?xml version="1.0"?>
  <music>List
    <CD>Classic
        music
        <Composer>Brahms</Composer>
    </CD>
 </music>
The nodes <CD> and <Composer> correspond to the fields CD and Composer respectively. The match criteria are specified as /music/CD and /music/CD/Composer.
All examples use the Document collection method. See How StreamServer reads and processes XML documents for information about collection methods.
Example 15
The value for the field CD is specified as “.” (dot). The following value is extracted from the XML input:
Classic
music
   Brahms
All characters, including tabs, line-break, etc., between <CD> and </CD> are extracted.
 
Example 16
The value for the field CD is specified as normalize-space(.). The following value is extracted from the XML input:
Classic music Brahms
The text nodes between <CD> and </CD> are extracted. Line-breaks, tabs, etc. are ignored.
 
Example 17
The value for the field CD is specified as text(). The following value is extracted from the XML input:
Classic
music
All characters, including tabs, line-break, etc., between <CD> and <Composer> are extracted.
 
Example 18
The value for the field CD is specified as normalize-space(text()). The following value is extracted from the XML input:
Classic music
The text nodes between <CD> and <Composer> are extracted. Line-breaks, tabs, etc. are ignored.
 
Example 19
The value for the field Composer is specified as ../../text(). The following value is extracted from the XML input:
List
 
Example 20
The value for the field Composer is specified as normalize-space(../../.). The following value is extracted from the XML input:
List Classic music Brahms
 
Example 21
The value for the field Composer is specified as
concat(name(.), ':', ' ', .).
The following value is extracted from the XML input:
Composer: Brahms
 
Supported XSLT and XPath functions
In the XSLT Patterns and XPath expressions, you can use the XSLT and XPath functions listed in Supported XSLT and XPath functions.
OpenText StreamServe 5.6 Updated: 2013-03-01