Table of Contents

Search

  1. Preface
  2. Introduction to Data Transformation
  3. Data Processor Transformation
  4. Wizard Input and Output Formats
  5. Relational Input and Output
  6. XMap
  7. Libraries
  8. Schema Object
  9. Command Line Interface
  10. Scripts
  11. Parsers
  12. Script Ports
  13. Document Processors
  14. Formats
  15. Data Holders
  16. Anchors
  17. Transformers
  18. Actions
  19. Serializers
  20. Mappers
  21. Locators, Keys, and Indexing
  22. Streamers
  23. Validators, Notifications, and Failure Handling
  24. Validation Rules
  25. Custom Script Components

Data Transformation User Guide

Data Transformation User Guide

XPath Arithmetic Operators

XPath Arithmetic Operators

To perform calculations, add arithmetic operators that evaluate hierarchical document nodes. You can add arithmetic operators to XPath expressions in the Input, Condition, or Output fields of a mapping statement.
The following table describes XPath arithmetic operators that you can use in XMap expressions:
XPath Expression
Description
|
Selects two node sets in context. For example, the predicate expression "//book | //cd" returns a node set with all book and cd elements.
+
Adds the elements. For example, the predicate expression "1+2" returns 3.
-
Subtracts the elements. For example, the predicate expression "2-1" returns 1.
*
Multiplies the elements. For example, the predicate expression "2*1" returns 2.
div
Divides the elements. For example, the predicate expression "6 div 3" returns 2.
=
Selects the elements that equal the expression. For example, the predicate expression "cost=1.50" returns true if the cost is 1.50, and false if the cost is 1.60.
!=
Selects the elements that are not equal to the expression. For example, the predicate expression "cost!=1.50" returns true if the cost is 1.60, and false if the cost is 1.50.
<
Selects the elements that are less than the expression. For example, the predicate expression "tax<1.50" returns true if the tax is 1.00, and false if the tax is 1.50.
<=
Selects the elements that are equal to or less than the expression. For example, the predicate expression "tax<=1.50" returns true if the tax is 1.50, and false if the tax is 1.80.
>
Selects the elements that are greater than the expression. For example, the predicate expression "tax>1.50" returns true if the tax is 1.90, and false if the tax is 1.50.
>=
Selects the elements that are equal to or greater than the expression. For example, the predicate expression "tax>=1.50" returns true if the tax is 1.50, and false if the tax is 1.00.
or
Selects the elements that can satisfy one or more conditions. For example, the predicate expression "tax=1.50 or tax=1.70" returns true if the tax is 1.50, and false if the tax is 1.00.
and
Selects the elements that can satisfy all the given conditions. For example, the predicate expression "price>1.00 and price<1.90" returns true if the price is 1.50, and false if the price is 1.00.
mode
Performs division and provides the remainder. For example, the predicate expression "3 mod 2" returns 1.


Updated September 26, 2018