内容节点和文档根的区别 [英] Difference between content node and document root

查看:40
本文介绍了内容节点和文档根的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近阅读了有关 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.

推荐答案

根节点 是 XML 文档中所有其他节点的祖先节点.它不是一个元素.它没有标记:您无法在序列化文档中看到它.它是最外层元素(以及该元素可能具有的任何兄弟元素,例如注释或处理指令)的父元素.根节点由 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 /.

令人困惑的是,最外面的元素有时被称为根元素",并且在 XML 规范;但在 XSLT 规范中,它只被称为文档元素.此元素由 XPath 表达式 /* 匹配.

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 /*.

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

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 ..

这篇关于内容节点和文档根的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆