You need to put the last()
indexing on the nodelist result, rather than as part of the selection criteria. Try:
(//element[@name="D"])[last()]
You need to put the last()
indexing on the nodelist result, rather than as part of the selection criteria. Try:
(//element[@name="D"])[last()]