Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Selects elements by their unique ID.

Syntax

		
node-set id(
object)

Parameters

object

White-space separated string of identifiers or a node-set.

Return Value

The node-set containing identifiers defined in object.

Remarks

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

When the argument is of any other type, it is converted to a string and then split into a white-space separated list of tokens (white space is any sequence of characters matching the production); the result is a node-set containing the elements in the same document as the context node that have a unique identifier equal to any of the tokens in the list.

The following selects the element with the unique identifier "mysample".

Copy Code
id("mysample")

The following selects the fifth para child of the element with unique identifier "mysample".

Copy Code
id("mysample")/child::para[position()=5]

See Also