Simple task. Here's the XPath expression:
/methods/method[@token = '06000009']/sequencePoints/entry[string(@ilOffset) <= string('00000e')][last()]
And here's a part of the XML document to query:
<methods>
<method token="06000009">
<sequencePoints>
<entry ilOffset="000000" startLine="178" startColumn="3" />
<entry ilOffset="000001" startLine="179" startColumn="4" />
<entry ilOffset="000008" startLine="180" startColumn="4" />
<entry ilOffset="000009" startLine="181" startColumn="5" />
<entry ilOffset="00000f" startLine="182" startColumn="4" />
<entry ilOffset="000010" hidden="true" />
<entry ilOffset="000022" hidden="true" />
<entry ilOffset="000023" startLine="183" startColumn="3" />
</sequencePoints>
</method>
</methods>
Finds nothing. But it should find this element:
<entry ilOffset="000009" ...>
Why doesn't it work?
I'm not sure whether I need the string()
conversion. But without it it doesn't work either. I just don't want XPath to compare numbers because that can go wrong with hex values.