raffian
raffian

Reputation: 32086

XPath, test last attribute value from list

I'm trying to test the last attribute value from this input XML. I'm using Saxon and XSLT 2.0

<history>
  <value date='2010-01-01' price='5.99'/>
  <value date='2010-01-02' price='6.49'/>
  <value date='2010-01-03' price='6.19'/>
</history>

I've tried these with the Eclipse Xpath evaluator, it gets the last node, but the attribute comparison does not evaluate to true.

 (/history/value[@price])[last()] = '6.19'
 (/history/value[last()])[@price] = '6.19'

Upvotes: 0

Views: 861

Answers (1)

Dabbler
Dabbler

Reputation: 9873

What you need is this:

/history/value[last()]/@price = '6.19'

Upvotes: 1

Related Questions