You can use XML Path Language (Xpath) functions to refine XPath queries and enhance the programming power and flexibility of XPath.
The functions are divided into the following groups.
Node-Set | Takes a node-set argument, returns a node-set, or returns/provides information about a particular node within a node-set. |
String | Performs evaluations, formatting, and manipulation on string arguments. |
Boolean | Evaluates the argument expressions to obtain a Boolean result. |
Number | Evaluates the argument expressions to obtain a numeric result. |
Microsoft XPath Extension Functions | Microsoft extension functions to XPath that provide the ability to select nodes by XSD type. Also includes string comparison, number comparison, and date/time conversion functions. |
Each function in the function library is specified using a function prototype that provides the return type, function name, and argument type. If an argument type is followed by a question mark, the argument is optional; otherwise, the argument is required. Function names are case-sensitive.
About XPath Functions
The XPath language provides for a core library of functions that deal with:
- node sets
- strings
- Booleans
- numbers
The following are some examples of XPath functions:
- Determine the number of articles written by Mr. Jones:
count(/journal/article[author/last="Jones"])
- Find all authors whose last name begins with Mc:
/journal/article[starts-with(author/last,"Mc")]
In addition to the core XPath functions defined by the XPath standard, a number of extended functions are also supported with OSM. These extended functions provide additional functionality that is useful to create behaviors, but does not conform to the XPath standard.