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 Expressions

XPath Expressions

XPath expressions identify specific elements or nodes in hierarchical documents or check for conditions in the data. Use XPath expressions to define the Input, Condition, or Output fields of a mapping statement.
XPath is a syntax that defines parts of an hierarchical document. Use XPath to select sequences of nodes or values in an hierarchical document. XPath includes a library of standard functions that you can use to select data.
You can define XPath 2.0 expressions in the Data Processor transformation. When you configure Output XPath expressions, you can use a subset of the XPath 2.0 syntax when you define mapping statements for Add mode or Match or Add mode.
For more information about XPath, refer to your XPath documentation.
The following table describes some XPath expressions:
XPath Expression
Description
nodename
Selects all child nodes of the given name in the context.
. (dot)
Selects current node.
..
Selects parent of current node.
@
Selects attribute.
/
Selects from root node or child of current node if preceded by node. When the path starts with a slash ( / ) it represents an absolute path to an element.
//
Selects nodes anywhere in the document or descendants of current node if preceded by node.
The following table lists some XPath expressions and the result of each expression:
XPath Expression
Result
/bookstore
Selects the root bookstore node.
bookstore/book
Selects book nodes that are children of all bookstore nodes.
//book
Selects the book nodes in the document in all locations.
bookstore//book
Selects all book nodes that are descendants of the bookstore nodes.
/bookstore/*
Selects all child nodes of bookstore root element.
//*
Returns a sequence of all elements in the document.