Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
993 views
in Technique[技术] by (71.8m points)

xslt - Difference between content node and document root

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...