Search code examples
xpathnode-set

confusion with Node Set Function - 'ID'


Function: node-set id(object)

When the argument to id is of type node-set, then the result is the union of the result of applying id to the string-value of each of the nodes in the argument node-set.

I didn't get the above lines from the doc. May I have one example to understand the same ?

Thanks


Solution

  • Sure

    Suppose your document uses an attribute idref="A B C" to contain a reference to the nodes with id="A", id="B", and id="C".

    Then id(//@idref) will select all the nodes with id's that are referenced in any @idref attribute anywhere in the document.