Difference between content node and document root

后端 未结 1 1106
耶瑟儿~
耶瑟儿~ 2020-12-20 08:26

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.

相关标签:
1条回答
  • 2020-12-20 08:52

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

    0 讨论(0)
提交回复
热议问题