In Brief

  • The Boolean operators are logical operators like != , < , > , >= , and so on. The boolean function converts its argument to a Boolean value, the false function returns a value of false , the lang function tests whether a node's language (set with the xml:lang attribute) is the same as the language passed to the function, the not function reverses the true/false value of its argument, and the true function returns a value of true .

  • The XPath 1.0 numeric operators include + , - , * , div , and mod . There are also a number of numeric functions ceiling() returns the smallest integer larger than the number you pass it, floor returns the largest integer smaller than the number you pass it, round rounds the number you pass it to the nearest integer, and sum returns the sum of the numbers you pass it.

  • There aren't any string-specific XPath 1.0 operators, but there are plenty of functions:

    • The concat function returns all strings you pass to it joined together.

    • The contains function returns true if the first string contains the second one.

    • The normalize-space function returns the string you pass to it after leading and trailing whitespace is stripped and multiple consecutive whitespace is replaced with a single space.

    • The starts-with function returns true if the first string you pass it starts with the second string.

    • The string-length function returns the number of characters in a string.

    • The substring function returns a substring from a string.

    • The substring-after function returns a substring after another string.

    • The substring-before function returns a substring before another string.

    • The translate function returns a string with all occurrences of the characters in a second string replaced by matching characters in a third string.



XPath. Navigating XML with XPath 1.0 and 2.0 Kick Start
XPath Kick Start: Navigating XML with XPath 1.0 and 2.0
ISBN: 0672324113
EAN: 2147483647
Year: 2002
Pages: 131

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net