Facing Problem With Max()

Wednesday, 25 March 2015 · 2 messages
AK
ankit kumar25 Mar 2015 15:44 #

Hi,

I am trying to get max value for a sequence of nodes using max(). I have a query which gives me a set of element and after that i get its max value.

let $elements := (<date>10-02-2012</date>,<date>12-02-2012<date>);
return max($element)

I am expecting that it gives me 10-02-2012, while it is giving error "cannot cast to double '10-02-2012'.

Thanks Ankit

CG
Christian Grün25 Mar 2015 15:49 #

Hi Ankit,

Please see the spec for more information:

http://www.w3.org/TR/xpath-functions-31/#func-max

Best, Christian

Quoted text · ankit kumar · 15 lines
On Wed, Mar 25, 2015 at 3:44 PM, ankit kumar <anky4bugs at gmail.com> wrote: > Hi, > > I am trying to get max value for a sequence of nodes using max(). I have a > query which gives me a set of element and after that i get its max value. > > let $elements := (<date>10-02-2012</date>,<date>12-02-2012<date>); > return max($element) > > I am expecting that it gives me 10-02-2012, while it is giving error "cannot > cast to double '10-02-2012'. > > > Thanks > Ankit

⚡Generated with XQuery