untitled

(ff) #1

8.1 XML Navigation Using XPath 179


sum(set) Sum of a set of matching elements or attributes
count(set) Number of matching elements or attributes in a set
position() The position in the current context
last() The last position in the current context
and The logical and operator
or The logical or operator
not The logical negation operator
+ Addition of two values


  • Subtraction. Because names can have hyphens
    always put spaces before and after the minus sign.
    div Division
    mod The remainder after division



  • Multiplication
    round(number) Round a number to the nearest integer
    floor(number) Round down to an integer
    ceiling(number) Round up to an integer
    . Navigate to the current element
    .. Navigate to the parent element
    / Navigate to a child element
    // Navigate to any contained (descendant) element
    | Match either of two choices
    starts-with(text) Test that text begins in a specified way
    substring(start,end,text) A part of some text
    string-length(text) The number of characters in some text
    = Test for equality
    != Test for not equal to
    < Test for less than. Note that<has a meaning
    in XML, so one must use the “escaped” notation.

    Test for greater than
    <= Test for less than or equal to
    = Test for greater than or equal to





Table 8.1 Some of the XPath operators
Free download pdf