Perform Data Manipulations in the Mapper
You can perform data manipulation tasks in the mapper such as padding characters, rounding numbers, extracting values, adding CDATA content, and calculating the sum of a node.
Pad Characters to a String
- Left-pad zeroes to nine
digits:
fn:format-number (12345, '000000000')
- Right-pad zeroes to nine
digits:
concat(string(12345),substring-before(fn:format-number (12345, '000000000'), string(12345))
Round a Number to the Required Digits
Round a number to two decimals:
fn:format-number (12345.12345, '#.00')
Extract a Value for a Key-Value Pair Type of XML
XML Snippet | XPath Expression | Explanation |
---|---|---|
|
Extract the value of parameter name
'NAME' :
|
Anything within the set braces in an XPath is called
a predicate.
The expression finds the parameter value
whose name is |
Add CDATA Content to an XML Element
XSLT Snippet | Output XML | Explanation |
---|---|---|
|
|
You must manually add the The output attribute must be
The attribute The data should be normally mapped to the element in which CDATA should be present. Note: This approach doesn't work for file-based operations such as stage file actions and FTP where the content is rewritten from XSLT. |
Calculate the Sum of a Node from a Group of Nodes
XML Snippet | XPath Expression | Explanation |
---|---|---|
|
|
The SUM function must be set on
current-group .
|