XML Path Language (XPath) 1.0W3C Recommendation 16 November 1999
Copyright © 1999 W3C® (MIT, INRIA, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. AbstractXPath is a language for addressing parts of an XML document, designed to be used by both XSLT and XPointer. Status of this documentThis document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from other documents. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web. The list of known errors in this specification is available at http://www.w3.org/1999/11/REC-xpath-19991116-errata. Comments on this specification may be sent to www-xpath-comments@w3.org; archives of the comments are available. The English version of this specification is the only normative version. However, for translations of this document, see http://www.w3.org/Style/XSL/translations.html. A list of current W3C Recommendations and other technical documents can be found at http://www.w3.org/TR. This specification is joint work of the XSL Working Group and the XML Linking Working Group and so is part of the W3C Style activity and of the W3C XML activity. Table of contents1 Introduction2 Location Paths 2.1 Location Steps 2.2 Axes 2.3 Node Tests 2.4 Predicates 2.5 Abbreviated Syntax 3 Expressions 3.1 Basics 3.2 Function Calls 3.3 Node-sets 3.4 Booleans 3.5 Numbers 3.6 Strings 3.7 Lexical Structure 4 Core Function Library 4.1 Node Set Functions 4.2 String Functions 4.3 Boolean Functions 4.4 Number Functions 5 Data Model 5.1 Root Node 5.2 Element Nodes 5.2.1 Unique IDs 5.3 Attribute Nodes 5.4 Namespace Nodes 5.5 Processing Instruction Nodes 5.6 Comment Nodes 5.7 Text Nodes 6 Conformance AppendicesA ReferencesA.1 Normative References A.2 Other References B XML Information Set Mapping (Non-Normative) 1 IntroductionXPath is the result of an effort to provide a common syntax and semantics for functionality shared between XSL Transformations [XSLT] and XPointer [XPointer]. The primary purpose of XPath is to address parts of an XML [XML] document. In support of this primary purpose, it also provides basic facilities for manipulation of strings, numbers and booleans. XPath uses a compact, non-XML syntax to facilitate use of XPath within URIs and XML attribute values. XPath operates on the abstract, logical structure of an XML document, rather than its surface syntax. XPath gets its name from its use of a path notation as in URLs for navigating through the hierarchical structure of an XML document. In addition to its use for addressing, XPath is also designed so that it has a natural subset that can be used for matching (testing whether or not a node matches a pattern); this use of XPath is described in XSLT. XPath models an XML document as a tree of nodes. There are different types of nodes, including element nodes, attribute nodes and text nodes. XPath defines a way to compute a string-value for each type of node. Some types of nodes also have names. XPath fully supports XML Namespaces [XML Names]. Thus, the name of a node is modeled as a pair consisting of a local part and a possibly null namespace URI; this is called an expanded-name. The data model is described in detail in [5 Data Model]. The primary syntactic construct in XPath is the expression. An expression matches the production Expr. An expression is evaluated to yield an object, which has one of the following four basic types:
Expression evaluation occurs with respect to a context. XSLT and XPointer specify how the context is determined for XPath expressions used in XSLT and XPointer respectively. The context consists of:
The context position is always less than or equal to the context size. The variable bindings consist of a mapping from variable names to variable values. The value of a variable is an object, which can be of any of the types that are possible for the value of an expression, and may also be of additional types not specified here. The function library consists of a mapping from function names to functions. Each function takes zero or more arguments and returns a single result. This document defines a core function library that all XPath implementations must support (see [4 Core Function Library]). For a function in the core function library, arguments and result are of the four basic types. Both XSLT and XPointer extend XPath by defining additional functions; some of these functions operate on the four basic types; others operate on additional data types defined by XSLT and XPointer. The namespace declarations consist of a mapping from prefixes to namespace URIs. The variable bindings, function library and namespace declarations used to evaluate a subexpression are always the same as those used to evaluate the containing expression. The context node, context position, and context size used to evaluate a subexpression are sometimes different from those used to evaluate the containing expression. Several kinds of expressions change the context node; only predicates change the context position and context size (see [2.4 Predicates]). When the evaluation of a kind of expression is described, it will always be explicitly stated if the context node, context position, and context size change for the evaluation of subexpressions; if nothing is said about the context node, context position, and context size, they remain unchanged for the evaluation of subexpressions of that kind of expression. XPath expressions often occur in XML attributes. The grammar
specified in this section applies to the attribute value after XML 1.0
normalization. So, for example, if the grammar uses the character
One important kind of expression is a location path. A location path selects a set of nodes relative to the context node. The result of evaluating an expression that is a location path is the node-set containing the nodes selected by the location path. Location paths can recursively contain expressions that are used to filter sets of nodes. A location path matches the production LocationPath. In the following grammar, the non-terminals QName and NCName are defined in [XML Names], and S is defined in [XML]. The grammar uses the same EBNF notation as [XML] (except that grammar symbols always have initial capital letters). Expressions are parsed by first dividing the character string to be parsed into tokens and then parsing the resulting sequence of tokens. Whitespace can be freely used between tokens. The tokenization process is described in [3.7 Lexical Structure]. 2 Location PathsAlthough location paths are not the most general grammatical construct in the language (a LocationPath is a special case of an Expr), they are the most important construct and will therefore be described first. Every location path can be expressed using a straightforward but rather verbose syntax. There are also a number of syntactic abbreviations that allow common cases to be expressed concisely. This section will explain the semantics of location paths using the unabbreviated syntax. The abbreviated syntax will then be explained by showing how it expands into the unabbreviated syntax (see [2.5 Abbreviated Syntax]). Here are some examples of location paths using the unabbreviated syntax:
There are two kinds of location path: relative location paths and absolute location paths. A relative location path consists of a sequence of one or more
location steps separated by An absolute location path consists of Location Paths
2.1 Location StepsA location step has three parts:
The syntax for a location step is the axis name and node test
separated by a double colon, followed by zero or more expressions each
in square brackets. For example, in
The node-set selected by the location step is the node-set that results from generating an initial node-set from the axis and node-test, and then filtering that node-set by each of the predicates in turn. The initial node-set consists of the nodes having the relationship
to the context node specified by the axis, and having the node type
and expanded-name specified
by the node test. For example, a location step
The initial node-set is filtered by the first predicate to generate a new node-set; this new node-set is then filtered using the second predicate, and so on. The final node-set is the node-set selected by the location step. The axis affects how the expression in each predicate is evaluated and so the semantics of a predicate is defined with respect to an axis. See [2.4 Predicates]. Location Steps
2.2 AxesThe following axes are available:
NOTE: The Axes2.3 Node TestsEvery axis has a principal node type. If an axis can contain elements, then the principal node type is element; otherwise, it is the type of the nodes that the axis can contain. Thus,
A node test that is a QName
is true if and only if the type of the node (see [5 Data Model])
is the principal node type and has
an expanded-name equal to
the expanded-name specified
by the QName. For example,
A QName in the node test is
expanded into an expanded-name using the namespace
declarations from the expression context. This is the same way
expansion is done for element type names in start and end-tags except
that the default namespace declared with A node test A node test can have the form NCName The node test A node test
2.4 PredicatesAn axis is either a forward axis or a reverse axis. An axis that only ever contains the context node or nodes that are after the context node in document order is a forward axis. An axis that only ever contains the context node or nodes that are before the context node in document order is a reverse axis. Thus, the ancestor, ancestor-or-self, preceding, and preceding-sibling axes are reverse axes; all other axes are forward axes. Since the self axis always contains at most one node, it makes no difference whether it is a forward or reverse axis. The proximity position of a member of a node-set with respect to an axis is defined to be the position of the node in the node-set ordered in document order if the axis is a forward axis and ordered in reverse document order if the axis is a reverse axis. The first position is 1. A predicate filters a node-set with respect to an axis to produce a new node-set. For each node in the node-set to be filtered, the PredicateExpr is evaluated with that node as the context node, with the number of nodes in the node-set as the context size, and with the proximity position of the node in the node-set with respect to the axis as the context position; if PredicateExpr evaluates to true for that node, the node is included in the new node-set; otherwise, it is not included. A PredicateExpr is evaluated by
evaluating the Expr and converting the result
to a boolean. If the result is a number, the result will be converted
to true if the number is equal to the context position and will be
converted to false otherwise; if the result is not a number, then the
result will be converted as if by a call to the
boolean function. Thus a location path
Predicates
2.5 Abbreviated SyntaxHere are some examples of location paths using abbreviated syntax:
The most important abbreviation is that There is also an abbreviation for attributes:
NOTE: The location path A location step of self::node()/descendant-or-self::node()/child::para and so will select all Similarly, a location step of Abbreviations
3 Expressions3.1 BasicsA VariableReference evaluates to the value to which the variable name is bound in the set of variable bindings in the context. It is an error if the variable name is not bound to any value in the set of variable bindings in the expression context. Parentheses may be used for grouping.
3.2 Function CallsA FunctionCall expression is evaluated by using the FunctionName to identify a function in the expression evaluation context function library, evaluating each of the Arguments, converting each argument to the type required by the function, and finally calling the function, passing it the converted arguments. It is an error if the number of arguments is wrong or if an argument cannot be converted to the required type. The result of the FunctionCall expression is the result returned by the function. An argument is converted to type string as if by calling the string function. An argument is converted to type number as if by calling the number function. An argument is converted to type boolean as if by calling the boolean function. An argument that is not of type node-set cannot be converted to a node-set.
3.3 Node-setsA location path can be used as an expression. The expression returns the set of nodes selected by the path. The Predicates are used to filter expressions in the same way that they are used in location paths. It is an error if the expression to be filtered does not evaluate to a node-set. The Predicate filters the node-set with respect to the child axis. NOTE: The meaning of a Predicate depends crucially on which axis applies. For example, The There are no types of objects that can be converted to node-sets.
3.4 BooleansAn object of type boolean can have one of two values, true and false. An An An EqualityExpr (that is not just
a RelationalExpr) or a RelationalExpr (that is not just an AdditiveExpr) is evaluated by comparing the
objects that result from evaluating the two operands. Comparison of
the resulting objects is defined in the following three paragraphs.
First, comparisons that involve node-sets are defined in terms of
comparisons that do not involve node-sets; this is defined uniformly
for If both objects to be compared are node-sets, then the comparison will be true if and only if there is a node in the first node-set and a node in the second node-set such that the result of performing the comparison on the string-values of the two nodes is true. If one object to be compared is a node-set and the other is a number, then the comparison will be true if and only if there is a node in the node-set such that the result of performing the comparison on the number to be compared and on the result of converting the string-value of that node to a number using the number function is true. If one object to be compared is a node-set and the other is a string, then the comparison will be true if and only if there is a node in the node-set such that the result of performing the comparison on the string-value of the node and the other string is true. If one object to be compared is a node-set and the other is a boolean, then the comparison will be true if and only if the result of performing the comparison on the boolean and on the result of converting the node-set to a boolean using the boolean function is true. When neither object to be compared is a node-set and the operator
is NOTE: If When neither object to be compared is a node-set and the operator
is NOTE: When an XPath expression occurs in an XML document, any
NOTE: The effect of the above grammar is that the order of precedence is (lowest precedence first): 3.5 NumbersA number represents a floating-point number. A number can have any double-precision 64-bit format IEEE 754 value [IEEE 754]. These include a special "Not-a-Number" (NaN) value, positive and negative infinity, and positive and negative zero. See Section 4.2.3 of [JLS] for a summary of the key rules of the IEEE 754 standard. The numeric operators convert their operands to numbers as if by calling the number function. The The NOTE: Since XML allows The The
NOTE: This is the same as the
NOTE: This is not the same as the IEEE 754 remainder operation, which returns the remainder from a rounding division. Numeric Expressions
3.6 StringsStrings consist of a sequence of zero or more characters, where a character is defined as in the XML Recommendation [XML]. A single character in XPath thus corresponds to a single Unicode abstract character with a single corresponding Unicode scalar value (see [Unicode]); this is not the same thing as a 16-bit Unicode code value: the Unicode coded character representation for an abstract character with Unicode scalar value greater that U+FFFF is a pair of 16-bit Unicode code values (a surrogate pair). In many programming languages, a string is represented by a sequence of 16-bit Unicode code values; implementations of XPath in such languages must take care to ensure that a surrogate pair is correctly treated as a single XPath character. NOTE: It is possible in Unicode for there to be two strings that should be treated as identical even though they consist of the distinct sequences of Unicode abstract characters. For example, some accented characters may be represented in either a precomposed or decomposed form. Therefore, XPath expressions may return unexpected results unless both the characters in the XPath expression and in the XML document have been normalized into a canonical form. See [Character Model]. 3.7 Lexical StructureWhen tokenizing, the longest possible token is always returned. For readability, whitespace may be used in expressions even though not explicitly allowed by the grammar: ExprWhitespace may be freely added within patterns before or after any ExprToken. The following special tokenization rules must be applied in the order specified to disambiguate the ExprToken grammar:
Expression Lexical Structure
4 Core Function LibraryThis section describes functions that XPath implementations must always include in the function library that is used to evaluate expressions. Each function in the function library is specified using a function prototype, which gives the return type, the name of the function, and the type of the arguments. If an argument type is followed by a question mark, then the argument is optional; otherwise, the argument is required. 4.1 Node Set FunctionsThe last function returns a number equal to the context size from the expression evaluation context. The position function returns a number equal to the context position from the expression evaluation context. Function: number count(node-set) The count function returns the number of nodes in the argument node-set. The id function selects elements by their unique ID (see [5.2.1 Unique IDs]). When the argument to id is of type node-set, then the result is the union of the result of applying id to the string-value of each of the nodes in the argument node-set. When the argument to id is of any other type, the argument is converted to a string as if by a call to the string function; the string is split into a whitespace-separated list of tokens (whitespace is any sequence of characters matching the production S); the result is a node-set containing the elements in the same document as the context node that have a unique ID equal to any of the tokens in the list.
Function: string local-name(node-set?) The local-name function returns the local part of the expanded-name of the node in the argument node-set that is first in document order. If the argument node-set is empty or the first node has no expanded-name, an empty string is returned. If the argument is omitted, it defaults to a node-set with the context node as its only member. Function: string namespace-uri(node-set?) The namespace-uri function returns the namespace URI of the expanded-name of the node in the argument node-set that is first in document order. If the argument node-set is empty, the first node has no expanded-name, or the namespace URI of the expanded-name is null, an empty string is returned. If the argument is omitted, it defaults to a node-set with the context node as its only member. NOTE: The string returned by the namespace-uri function will be empty except for element nodes and attribute nodes. Function: string name(node-set?) The name function returns a string containing a QName representing the expanded-name of the node in the argument node-set that is first in document order. The QName must represent the expanded-name with respect to the namespace declarations in effect on the node whose expanded-name is being represented. Typically, this will be the QName that occurred in the XML source. This need not be the case if there are namespace declarations in effect on the node that associate multiple prefixes with the same namespace. However, an implementation may include information about the original prefix in its representation of nodes; in this case, an implementation can ensure that the returned string is always the same as the QName used in the XML source. If the argument node-set is empty or the first node has no expanded-name, an empty string is returned. If the argument it omitted, it defaults to a node-set with the context node as its only member. NOTE: The string returned by the name function will be the same as the string returned by the local-name function except for element nodes and attribute nodes. 4.2 String FunctionsFunction: string string(object?) The string function converts an object to a string as follows:
If the argument is omitted, it defaults to a node-set with the context node as its only member. NOTE: The Function: string concat(string, string, string*) The concat function returns the concatenation of its arguments. Function: boolean starts-with(string, string) The starts-with function returns true if the first argument string starts with the second argument string, and otherwise returns false. Function: boolean contains(string, string) The contains function returns true if the first argument string contains the second argument string, and otherwise returns false. Function: string substring-before(string, string) The substring-before function returns the substring
of the first argument string that precedes the first occurrence of the
second argument string in the first argument string, or the empty
string if the first argument string does not contain the second
argument string. For example,
Function: string substring-after(string, string) The substring-after function returns the
substring of the first argument string that follows the first
occurrence of the second argument string in the first argument string,
or the empty string if the first argument string does not contain the
second argument string. For example,
Function: string substring(string, number, number?) The substring function returns the substring of the
first argument starting at the position specified in the second
argument with length specified in the third argument. For example,
More precisely, each character in the string (see [3.6 Strings]) is considered to have a numeric position: the position of the first character is 1, the position of the second character is 2 and so on.
NOTE: This differs from Java and ECMAScript, in which the
The returned substring contains those characters for which the position of the character is greater than or equal to the rounded value of the second argument and, if the third argument is specified, less than the sum of the rounded value of the second argument and the rounded value of the third argument; the comparisons and addition used for the above follow the standard IEEE 754 rules; rounding is done as if by a call to the round function. The following examples illustrate various unusual cases:
Function: number string-length(string?) The string-length returns the number of characters in the string (see [3.6 Strings]). If the argument is omitted, it defaults to the context node converted to a string, in other words the string-value of the context node. Function: string normalize-space(string?) The normalize-space function returns the argument string with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of whitespace characters by a single space. Whitespace characters are the same as those allowed by the S production in XML. If the argument is omitted, it defaults to the context node converted to a string, in other words the string-value of the context node. Function: string translate(string, string, string) The translate function returns the first
argument string with occurrences of characters in the second argument
string replaced by the character at the corresponding position in the
third argument string. For example,
NOTE: The translate function is not a sufficient solution for case conversion in all languages. A future version of XPath may provide additional functions for case conversion. 4.3 Boolean FunctionsFunction: boolean boolean(object) The boolean function converts its argument to a boolean as follows:
Function: boolean not(boolean) The not function returns true if its argument is false, and false otherwise. The true function returns true. The false function returns false. Function: boolean lang(string) The lang function returns true or false depending on
whether the language of the context node as specified by
<para xml:lang="en"/> <div xml:lang="en"><para/></div> <para xml:lang="EN"/> <para xml:lang="en-us"/> 4.4 Number FunctionsFunction: number number(object?) The number function converts its argument to a number as follows:
If the argument is omitted, it defaults to a node-set with the context node as its only member. NOTE: The number function should not be used for conversion of numeric data occurring in an element in an XML document unless the element is of a type that represents numeric data in a language-neutral format (which would typically be transformed into a language-specific format for presentation to a user). In addition, the number function cannot be used unless the language-neutral format used by the element is consistent with the XPath syntax for a Number. Function: number sum(node-set) The sum function returns the sum, for each node in the argument node-set, of the result of converting the string-values of the node to a number. Function: number floor(number) The floor function returns the largest (closest to positive infinity) number that is not greater than the argument and that is an integer. Function: number ceiling(number) The ceiling function returns the smallest (closest to negative infinity) number that is not less than the argument and that is an integer. Function: number round(number) The round function returns the number that is closest to the argument and that is an integer. If there are two such numbers, then the one that is closest to positive infinity is returned. If the argument is NaN, then NaN is returned. If the argument is positive infinity, then positive infinity is returned. If the argument is negative infinity, then negative infinity is returned. If the argument is positive zero, then positive zero is returned. If the argument is negative zero, then negative zero is returned. If the argument is less than zero, but greater than or equal to -0.5, then negative zero is returned. NOTE: For these last two cases, the result of calling the round function is not the same as the result of adding 0.5 and then calling the floor function. 5 Data ModelXPath operates on an XML document as a tree. This section describes how XPath models an XML document as a tree. This model is conceptual only and does not mandate any particular implementation. The relationship of this model to the XML Information Set [XML Infoset] is described in [B XML Information Set Mapping]. XML documents operated on by XPath must conform to the XML Namespaces Recommendation [XML Names]. The tree contains nodes. There are seven types of node:
For every type of node, there is a way of determining a string-value for a node of that type. For some types of node, the string-value is part of the node; for other types of node, the string-value is computed from the string-value of descendant nodes.
NOTE: For element nodes and root nodes, the string-value of a node
is not the same as the string returned by the DOM
Some types of node also have an expanded-name, which is a pair consisting of a local part and a namespace URI. The local part is a string. The namespace URI is either null or a string. The namespace URI specified in the XML document can be a URI reference as defined in [RFC2396]; this means it can have a fragment identifier and can be relative. A relative URI should be resolved into an absolute URI during namespace processing: the namespace URIs of expanded-names of nodes in the data model should be absolute. Two expanded-names are equal if they have the same local part, and either both have a null namespace URI or both have non-null namespace URIs that are equal. There is an ordering, document order, defined on all the nodes in the document corresponding to the order in which the first character of the XML representation of each node occurs in the XML representation of the document after expansion of general entities. Thus, the root node will be the first node. Element nodes occur before their children. Thus, document order orders element nodes in order of the occurrence of their start-tag in the XML (after expansion of entities). The attribute nodes and namespace nodes of an element occur before the children of the element. The namespace nodes are defined to occur before the attribute nodes. The relative order of namespace nodes is implementation-dependent. The relative order of attribute nodes is implementation-dependent. Reverse document order is the reverse of document order. Root nodes and element nodes have an ordered list of child nodes. Nodes never share children: if one node is not the same node as another node, then none of the children of the one node will be the same node as any of the children of another node. Every node other than the root node has exactly one parent, which is either an element node or the root node. A root node or an element node is the parent of each of its child nodes. The descendants of a node are the children of the node and the descendants of the children of the node. 5.1 Root NodeThe root node is the root of the tree. A root node does not occur except as the root of the tree. The element node for the document element is a child of the root node. The root node also has as children processing instruction and comment nodes for processing instructions and comments that occur in the prolog and after the end of the document element. The string-value of the root node is the concatenation of the string-values of all text node descendants of the root node in document order. The root node does not have an expanded-name. 5.2 Element NodesThere is an element node for every element in the document. An element node has an expanded-name computed by expanding the QName of the element specified in the tag in accordance with the XML Namespaces Recommendation [XML Names]. The namespace URI of the element's expanded-name will be null if the QName has no prefix and there is no applicable default namespace. NOTE: In the notation of Appendix A.3 of [XML Names], the local part of the expanded-name corresponds to the The children of an element node are the element nodes, comment nodes, processing instruction nodes and text nodes for its content. Entity references to both internal and external entities are expanded. Character references are resolved. The string-value of an element node is the concatenation of the string-values of all text node descendants of the element node in document order. 5.2.1 Unique IDsAn element node may have a unique identifier (ID). This is the
value of the attribute that is declared in the DTD as type
NOTE: If a document does not have a DTD, then no element in the document will have a unique ID. 5.3 Attribute NodesEach element node has an associated set of attribute nodes; the element is the parent of each of these attribute nodes; however, an attribute node is not a child of its parent element. NOTE: This is different from the DOM, which does not treat the element bearing an attribute as the parent of the attribute (see [DOM]). Elements never share attribute nodes: if one element node is not the same node as another element node, then none of the attribute nodes of the one element node will be the same node as the attribute nodes of another element node. NOTE: The A defaulted attribute is treated the same as a specified attribute.
If an attribute was declared for the element type in the DTD, but the
default was declared as Some attributes, such as An attribute node has an expanded-name and a string-value. The expanded-name is computed by expanding the QName specified in the tag in the XML document in accordance with the XML Namespaces Recommendation [XML Names]. The namespace URI of the attribute's name will be null if the QName of the attribute does not have a prefix. NOTE: In the notation of Appendix A.3 of [XML Names], the local part of the expanded-name corresponds to the An attribute node has a string-value. The string-value is the normalized value as specified by the XML Recommendation [XML]. An attribute whose normalized value is a zero-length string is not treated specially: it results in an attribute node whose string-value is a zero-length string. NOTE: It is possible for default attributes to be declared in an external DTD or an external parameter entity. The XML Recommendation does not require an XML processor to read an external DTD or an external parameter unless it is validating. A stylesheet or other facility that assumes that the XPath tree contains default attribute values declared in an external DTD or parameter entity may not work with some non-validating XML processors. There are no attribute nodes corresponding to attributes that declare namespaces (see [XML Names]). 5.4 Namespace NodesEach element has an associated set of namespace nodes, one for each
distinct namespace prefix that is in scope for the element (including
the
A namespace node has an expanded-name: the local part is the namespace prefix (this is empty if the namespace node is for the default namespace); the namespace URI is always null. The string-value of a namespace node is the namespace URI that is being bound to the namespace prefix; if it is relative, it must be resolved just like a namespace URI in an expanded-name. 5.5 Processing Instruction NodesThere is a processing instruction node for every processing instruction, except for any processing instruction that occurs within the document type declaration. A processing instruction has an expanded-name: the local part is
the processing instruction's target; the namespace URI is null. The
string-value of a processing
instruction node is the part of the processing instruction following
the target and any whitespace. It does not include the terminating
NOTE: The XML declaration is not a processing instruction. Therefore, there is no processing instruction node corresponding to the XML declaration. 5.6 Comment NodesThere is a comment node for every comment, except for any comment that occurs within the document type declaration. The string-value of
comment is the content of the comment not including the opening
A comment node does not have an expanded-name. 5.7 Text NodesCharacter data is grouped into text nodes. As much character data as possible is grouped into each text node: a text node never has an immediately following or preceding sibling that is a text node. The string-value of a text node is the character data. A text node always has at least one character of data. Each character within a CDATA section is treated as character data.
Thus, NOTE: When a text node that contains a Characters inside comments, processing instructions and attribute values do not produce text nodes. Line-endings in external entities are normalized to #xA as specified in the XML Recommendation [XML]. A text node does not have an expanded-name. 6 ConformanceXPath is intended primarily as a component that can be used by other specifications. Therefore, XPath relies on specifications that use XPath (such as [XPointer] and [XSLT]) to specify criteria for conformance of implementations of XPath and does not define any conformance criteria for independent implementations of XPath. A ReferencesA.1 Normative References
A.2 Other References
B XML Information Set Mapping (Non-Normative)The nodes in the XPath data model can be derived from the information items provided by the XML Information Set [XML Infoset] as follows: NOTE: A new version of the XML Information Set Working Draft, which will replace the May 17 version, was close to completion at the time when the preparation of this version of XPath was completed and was expected to be released at the same time or shortly after the release of this version of XPath. The mapping is given for this new version of the XML Information Set Working Draft. If the new version of the XML Information Set Working has not yet been released, W3C members may consult the internal Working Group version http://www.w3.org/XML/Group/1999/09/WD-xml-infoset-19990915.html (members only).
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
