/* selects the root element, regardless of name. ./* or * selects all child elements of the context node, regardless of name.
Unlike ID attributes, every element in a web page has a unique XPath.
Definition of XPath attribute. For finding an XPath node in an XML document, use the XPath Attribute expression location path. We can use XPath to generate attribute expressions to locate nodes in an XML document.
Current node is the node that the XPath processor is looking at when it begins evaluation of a query. In other words, the current node is the first context node that the XPath processor uses when it starts to execute the query. During evaluation of a query, the current node does not change.
XML Source:
<documents>
<document>
<id>3</id>
</document>
<document>
<id>7</id>
</document>
<document>
<id>1</id>
</document>
</documents>
I need the document-element with the highest value in its id-element (so <document><id>7</id></document>
in the example). I can't change the C# code, it is XMLDocument.SelectSingleNode(...)
, I only can modify the XPath used.
Is there something like documents/document[id=max(id)]
or like order by id descending
to get it?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With