XPath get max value

  • Thread starter Thread starter beachboy
  • Start date Start date
B

beachboy

can we get the max value of element from xpath

e.g: Xpath Query Expression: /Books/Book[@id='3'] to select XMLNode which id
is "3"

Can I use Xpath to get the MAX Book id?

Thanks in advanced.
 
use last() function like /Books/Book[@id=last()]
can we get the max value of element from xpath
e.g: Xpath Query Expression: /Books/Book[@id='3'] to select XMLNode which id
is "3"
Can I use Xpath to get the MAX Book id?

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
Sorry, count() function, certainly
can we get the max value of element from xpath
e.g: Xpath Query Expression: /Books/Book[@id='3'] to select XMLNode which id
is "3"
Can I use Xpath to get the MAX Book id?

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
count is not the same as max :-)


Michael Nemtsev said:
Sorry, count() function, certainly
can we get the max value of element from xpath
e.g: Xpath Query Expression: /Books/Book[@id='3'] to select XMLNode which
id
is "3"
Can I use Xpath to get the MAX Book id?

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not
cease to be insipid." (c) Friedrich Nietzsche
 
Michael Nemtsev said:
Sorry, count() function, certainly

That won't help unless the book ids are guaranteed to start at 1 and
increase by 1 each time.

The max() function sounds like what's required here.
 
Back
Top