内容节点和文档根之间的区别

发布于 2024-11-06 09:18:23 字数 79 浏览 0 评论 0 原文

我最近阅读了有关 XSLT 和 Xpath 的内容。但我多次遇到文档根和内容节点。这些是一样的吗?还是不同?

如果错了请纠正我。

I have recently read about XSLT and Xpath. But i came across document root and content node, so many times. Are these are same? Or different?

Correct me if am wrong.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雅心素梦 2024-11-13 09:18:23

根节点是 XML 文档中所有其他节点的祖先节点。它不是一个元素。它没有标记:您无法在序列化文档中看到它。它是最外层元素(以及该元素可能具有的任何同级元素,例如注释或处理指令)的父级。根节点由 XPath 表达式 / 匹配。

令人困惑的是,最外面的元素有时被称为“根元素”,并在 XML 规范;但在 XSLT 规范中,它仅称为文档元素。该元素与 XPath 表达式 /* 匹配。

上下文节点(如果这就是您想要的 - 我正在查看您关于混淆的评论)是处理器在评估特定(片段)时认为是当前要关注的节点的任何节点XPath 表达式或 XSLT 指令,因为它出现在 XSLT 样式表或其他执行环境的上下文中。请参阅 XSLT 规范中的 current-node。上下文节点是XPath表达式.的含义。

The root node is the node that is the ancestor of all other nodes in the XML document. It is not an element. It has no markup: you cannot see it in a serialized document. It is the parent of the outermost element (and of any siblings that element may have, such as comments or processing instructions). The root node is matched by the XPath expression /.

Confusingly, the outermost element is sometimes called the "root element," and is referred to that way in the XML specification; but in the XSLT specification it is only called the document element. This element is matched by the XPath expression /*.

The context node (if that's what you wanted -- I'm looking at your comment about a confusion) is whatever node the processor considers to be the current node to focus on, when evaluating a particular (piece of an) XPath expression or XSLT instruction, as it occurs in the context of an XSLT stylesheet or other execution environment. See current-node in the XSLT spec. The context node is the meaning of the XPath expression ..

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