XPath Operators
All operators defined by XPath are listed here.

Mathematical Operators |

+ (plus)
  Adds one number to another

- (minus)
  Subtracts one number from another

* (multiplication)
  Multiplies one number by another

div
  Performs a floating-point division between two numbers

mod
  Returns the floating-point remainder of dividing one number by another

Boolean Operators |

=
  Tests whether two expressions are equal.

<
  Tests whether the first expression is less than the second. Within an attribute, this operator must be coded & lt; .

< =
  Tests whether the first expression is less than or equal to the second. Within an attribute, this operator must be coded & lt;= .

>
  Tests whether the first expression is greater than the second. Within an attribute, this operator can be coded & gt; .

> =
  Tests whether the first expression is greater than or equal to the second. Within an attribute, this operator can be coded & gt;= .

!=
  Tests whether the two expressions are not equal.

and
  Tests whether both the first and second expressions are true . If the first expression is false , the second is not evaluated.

or
  Tests whether either the first or second expressions are true . If the first expression is true , the second is not evaluated.

Comparing values of various datatypes

For the first six boolean operators, comparing values of various datatypes is complicated. We explain the various possibilities here:

If both objects are boolean values
  Then they are equal if they have the same value. For less-than and greater-than comparisons, false is considered less than true (the function call number(false()) returns 0 , while number(true()) returns 1 ).

If both objects are numbers
  Then the operators work just the way you'd think they would.

If both objects are strings
  Then they are equal if their Unicode characters are identical. For less-than and greater-than comparisons, the character codes are compared.

If neither object is a node-set and the operator is = or !=
  Then the two objects are converted to the same object type, and the comparison works as described previously. If one of the objects is a boolean, then the objects are converted to boolean values as if by a call to the boolean() function. If none of the objects are boolean, the next attempted conversion is to a number. If one of the objects is a number, then the objects are converted to numeric values as if by a call to the number() function. Otherwise, all objects are converted to strings as if by a call to the string() function.

If neither object is a node-set and the operator is < , > , or > =
  Then the objects are converted to numbers and compared.

If one or both of the objects is a node-set
  Then things really get complicated. If both objects are node-sets, a comparison is true when the string value of at least one node in the first node-set is equal to the string value of at least one node in the second node-set. If one object is a node-set and the other is a number, string, or boolean, the comparison is true when there is at least one node in the node set whose number, string, or boolean value is equal to that number, string, or boolean value.

Expression Operators |

/
  The stepping operator, which is used to separate steps in a location path. If an XPath expression begins with / , it represents the root of the document.

//
  The abbreviated syntax for the descendant-or-self axis.

.
  The abbreviated syntax for the self axis.

..
  The abbreviated syntax for the parent axis.

@
  The abbreviated syntax for the attribute axis.

  The union operator. For example, the match attribute in the element < xsl:template match= " a|b " > matches all < a > and < b > elements.

*
  A wildcard that represents any node of the principal node type. child::* selects all element children of the context node, attribute::* selects all attributes of the context node, etc. Using the abbreviated syntax, * selects all element children of the context node, and @* selects all attributes of the context node. Contrast the wildcard operator with the node() node test, which matches any node, regardless of type.

[]
  The predicate operator, used to contain a predicate expression that filters a group of nodes.

$
  The variable operator, used to indicate that a given symbol is a variable name.