详细实例参考:http://www.stylusstudio.com/docs/v62/d_xpath15.html
Function
|
Source
|
Returns
|
---|---|---|
Boolean value that is the result of converting an object to a Boolean value. See
Converting an Object to Boolean.
| ||
Number that is the smallest integer that is not less than a number you specify. See
Obtaining the Largest, Smallest, or Closest Number.
| ||
Comment nodes. See
Obtaining Particular Types of Nodes By Using Node Tests.
| ||
String that concatenates two or more strings you specify. See
Concatenating Strings.
| ||
Nodes that contain the specified string. See
Searching for Strings.
| ||
Number of nodes in the node-set argument. See
Determining the Number of Nodes in a Collection.
| ||
Node for which the current template started its operation. See
Obtaining the Current Node for the Current XSLT Template.
| ||
Root node of the specified document. See
Accessing Other Documents During Query Execution.
| ||
Boolean value that indicates whether the specified element is supported by the XSLT processor. See
Determining If Functions Are Available.
| ||
false . See
Obtaining Boolean Values.
| ||
Number that is the largest integer that is not greater than a number you specify. See
Obtaining the Largest, Smallest, or Closest Number.
| ||
Boolean value that indicates whether the specified function is supported by the XPath processor. See
Determining If Functions Are Available.
| ||
String that uniquely, temporarily, identifies a node. See
Generating Temporary IDs for Nodes.
| ||
Element whose
id attribute value matches the specified value. See
Finding an Element with a Particular ID.
| ||
Node whose
key value matches the specified key. See
Finding an Element with a Particular Key.
| ||
Boolean value that indicates whether the language of the node is the language you expect. See
Determining the Context Node Language.
| ||
Number of nodes in the context list. See
Determining the Number of Nodes in a Collection.
| ||
Local portion of the node name, excluding the prefix. See
Obtaining Namespace Information.
| ||
String that contains the tag name of the node, including namespace information, if any. See
Obtaining Namespace Information.
| ||
URI for the namespace of the node. See
Obtaining Namespace Information.
| ||
All nonattribute nodes. See
Obtaining Particular Types of Nodes By Using Node Tests.
| ||
String without leading or trailing white space. See
Normalizing Strings.
| ||
Boolean value that indicates the opposite of the specified Boolean value. See
Obtaining Boolean Values.
| ||
Number that is the result of converting the specified argument to a number. See
Converting an Object to a Number.
| ||
Position number of the node relative to the context node set. See
Finding a Particular Node.
| ||
Processing instruction nodes. If you specify a literal argument, this function returns a processing instruction if its name matches the literal you specify. See
Obtaining Particular Types of Nodes By Using Node Tests.
| ||
Number that is the closest to the argument and is an integer. See
Obtaining the Largest, Smallest, or Closest Number.
| ||
Boolean value that indicates if a string starts with a particular string. See
Finding Strings That Start with a Particular String.
| ||
String that is the result of converting some object to a string. See
Converting Objects to Strings.
| ||
Number of characters in a string you specify. See
Determining the Number of Characters in a String.
| ||
Substring that is in a particular position within its string. See
Finding Substrings by Position.
| ||
Substring that appears before a string you specify. See
Finding Substrings That Appear Before Strings You Specify.
| ||
Substring that appears after a string you specify. See
Finding Substrings That Appear After Strings You Specify.
| ||
Number that is the sum of the values of the nodes in the specified set. See
Obtaining the Sum of the Values in a Node Set.
| ||
Object that represents the specified property. See
Obtaining System Properties.
| ||
String with some characters replaced by other characters. See
Replacing Characters in Strings with Characters You Specify.
| ||
true . See
Obtaining Boolean Values.
| ||
URI of an unparsed entity with the specified name. See
Obtaining the URI for an Unparsed Entity.
|
XPath Syntax Quick Reference
This topic provides a quick reference for XPath expression syntax.
Axes
XPath provides the following axes:
Node Tests
XPath provides the following node tests:
-
*
selects all nodes of the specified name. For theattribute
axis, attributes are selected. For thenamespace
axis, namespace nodes are selected. For all other axes, element nodes are selected.
comment()
selects all comment nodes.
- element_name selects all element_name nodes.
node()
selects all nodes.
processing-instruction(["
some_literal"])
selects all processing instructions. If some_literal is specified,processing-instruction()
selects all processing instructions with some_literal as their name.
text()
selects all text nodes.
Filters
A filter specifies a constraint on a node set with respect to an axis to produce a new node set.
Location Steps
A location step has the following format:
XPath Expression
An XPath expression has one of the following formats:
A function call or an XPath expression in parentheses can appear only at the very beginning of an XPath expression. An expression in parentheses always returns a node set. Any function that appears at the beginning of an XPath location step expression must return a node set.
XPath Abbreviations Quick Reference
Table 68 defines the abbreviations you can use in XPath expressions:
Table 69 shows examples of abbreviations in XPath expressions