An XPath expression specifies a part of any XML object to which it is applied.
XPath models XML as a hierarchical tree of nodes. The best way of thinking of this structure is to say the following: An XPath operation takes an XPath node-set (or XML converted into an XPath node-set) and then tags certain nodes in that set as being selected. As long as you stay in the world of XPath node-sets, the entire original node-set remains accessible through XPath operations that can find related nodes from any starting node in the set. For example, XPath operations can find ancestor or descendant nodes. As soon as you leave the XPath world with a selected node-set, all nodes not output are lost. In XML Security, the nodes output exactly match those selected. For other uses of XPath, the nodes output might consist of the selected nodes and all nodes for which a selected node is an ancestor. For example, losing the nodes not output could occur when printing a selected node-set or using the selected nodes and original node-set to construct a new XML object.