Axes - XPath 编辑

XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes There are thirteen different axes in the XPath specification. An axis represents a relationship to the context node, and is used to locate nodes relative to that node on the tree. The following is an extremely brief description of the thirteen available axes and the degree of support available in Gecko.

For further information on using XPath expressions, please see the For Further Reading section at the end of Transforming XML with XSLT document. Also see the 'axes' section in the xpath spec.

ancestor
Indicates all the ancestors of the context node beginning with the parent node and traveling through to the root node.
ancestor-or-self
Indicates the context node and all of its ancestors, including the root node.
attribute
Indicates the attributes of the context node. Only elements have attributes. This axis can be abbreviated with the at sign (@).
child
Indicates the children of the context node. If an XPath expression does not specify an axis, this is understood by default. Since only the root node or element nodes have children, any other use will select nothing.
descendant
Indicates all of the children of the context node, and all of their children, and so forth. Attribute and namespace nodes are not included - the parent of an attribute node is an element node, but attribute nodes are not the children of their parents.
descendant-or-self
Indicates the context node and all of its descendants. Attribute and namespace nodes are not included - the parent of an attribute node is an element node, but attribute nodes are not the children of their parents.
following
Indicates all the nodes that appear after the context node, except any descendant, attribute, and namespace nodes.
following-sibling
Indicates all the nodes that have the same parent as the context node and appear after the context node in the source document.
namespace (not supported)
Indicates all the nodes that are in scope for the context node. In this case, the context node must be an element node.
parent
Indicates the single node that is the parent of the context node. It can be abbreviated as two periods (..).
preceding
Indicates all the nodes that precede the context node in the document except any ancestor, attribute and namespace nodes.
preceding-sibling
Indicates all the nodes that have the same parent as the context node and appear before the context node in the source document.
self
Indicates the context node itself. It can be abbreviated as a single period (.).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:188 次

字数:4178

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文