Skip to main content

id

Function id 

Source
pub fn id<N: DomNavigator>(
    context: &mut DynamicContext<'_, N>,
    args: Vec<XPathValue<N>>,
) -> Result<XPathValue<N>, XPathError>
Expand description

Implements fn:id - selects elements by their ID attribute value.

If 1 arg: uses context item as reference node. If 2 args: second arg is the reference node.

The reference node determines which document tree to search. Each string argument is tokenized by whitespace and each token is looked up via find_element_by_id. Results are deduplicated and returned in document order.

Without DTD/schema ID declarations, the default find_element_by_id returns None, so this returns an empty sequence.