Name

id( )

Synopsis

                     node-set id(string IDs)
node-set id(node-set IDs)

The id( ) function returns a node-set containing all elements in the document with any of the specified IDs. (More specifically, those elements that have an attribute declared to be type ID in the input document’s DTD.) If the argument is a string, then this string is interpreted as a whitespace-separated list of IDs, and the function returns a node-set containing any elements that have an ID matching one of these IDs. If the argument is a node-set, then each node in the set is converted to a string, which is in turn treated as a whitespace-separated list of IDs. The returned node-set contains all the elements whose ID matches any ID in the string-value of any of these nodes. Finally, if the argument is any other type, then it’s converted to a string, as by the string( ) function, and it returns the same result as passing that string-value to id( ) directly.

Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.