Table of Contents

Search

  1. Preface
  2. XML Concepts
  3. Using XML with PowerCenter
  4. Working with XML Sources
  5. Using the XML Editor
  6. Working with XML Targets
  7. XML Source Qualifier Transformation
  8. Midstream XML Transformations
  9. Appendix A: XML Datatype Reference
  10. Appendix B: XPath Query Functions Reference

XML Guide

XML Guide

Function Quick Reference

Function Quick Reference

Use the following types of function in an XPath query predicate:
  • String.
    Use string functions to test substring values, concatenate strings, or translate strings into other strings. For example, the following XPath query predicate determines if an employee’s full name is equal to the concatenation of last name and first name:
    EMPLOYEE[./FULLNAME=concat(./ENAME/LASTNAME,./ENAME/FIRSTNAME)]
  • Numeric.
    Use numeric functions with element and attribute values. Numeric functions operate on numbers and return integers. For example, the following XPath query predicate rounds discount and tests if the result is greater than 15:
    ORDER_ITEMS[round(./DISCOUNT) > 15]
  • Boolean.
    Use Boolean functions to test elements, check the language attribute, or force a true or false result. For example, the following XPath query predicate returns true if the value is greater than zero:
    boolean(string)
The following table describes XPath query predicate string functions:
Function
Syntax
Description
concat
concat ( string1, string2 )
Concatenates two strings.
contains
contains ( string, substring )
Determines a string contains another string.
normalize-space
normalize-space ( string )
Strips leading and trailing white space from a string.
starts-with
starts-with ( string, substring )
Determines if string1 starts with string2.
string
string ( value )
Converts a number or Boolean to a string.
string-length
string-length ( string )
Returns the number of characters in a string, including trailing blanks.
substring
substring ( string, start [ ,length ] )
Returns a portion of a string starting at a specified position.
substring-after
substring-after ( string, substring )
Returns a portion of a string starting at a specified position.
substring-before
substring-before ( string, substring )
Returns the characters in a string that occur before a substring.
translate
translate ( string1, string2, string3 )
Converts the characters in a string to other characters.
The following table describes XPath query predicate number functions:
Function
Syntax
Description
ceiling
ceiling ( number )
Rounds a number to the smallest integer that is greater than or equal to the passed number.
floor
floor ( number )
Rounds a number to the largest integer that is less than or equal to the passed number.
number
number ( value )
Converts a string or Boolean value to a number.
round
round ( number )
Rounds a number to the nearest integer.
The following table describes XPath query predicate Boolean functions:
Function
Syntax
Description
boolean
boolean ( object )
Converts an object to Boolean.
false
false ( )
Always returns FALSE.
lang
lang ( code )
Determines if an element has an xml:lang attribute that matches the code argument.
not
not ( condition )
Returns TRUE if a Boolean condition is FALSE and FALSE if the Boolean condition is TRUE.
true
true ( )
Always returns TRUE.

0 COMMENTS

We’d like to hear from you!