From: xx r. <xx...@wi...> - 2010-09-01 14:22:40
|
Any help please?????????? From: xx...@wi... To: exi...@li... Subject: max Function Date: Tue, 31 Aug 2010 20:58:00 +0300 Hi, I have a problem using the max() function, on the following xml db <Trainers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\Program Files\eXist\webapp\xquery\Project\trainers.xsd"> <TrainerInformation> . . . <Competences> <Competence_Name>Make appropriate use of technology tools</Competence_Name> <Competence_Category>Technology</Competence_Category> <Competence_Level>2</Competence_Level> </Competences> <Competences> <Competence_Name>Demonstrate effective presentation skills</Competence_Name> <Competence_Category>Communication</Competence_Category> <Competence_Level>3</Competence_Level> </Competences> </TrainerInformation> <TrainerInformation> . . . <Competences> <Competence_Name>Make appropriate use of technology tools</Competence_Name> <Competence_Category>Technology</Competence_Category> <Competence_Level>4</Competence_Level> </Competences> <Competences> <Competence_Name>Demonstrate effective presentation skills</Competence_Name> <Competence_Category>Communication</Competence_Category> <Competence_Level>1</Competence_Level> </Competences> </TrainerInformation> </Trainers> I want to find the maximum Competence_Level for a certain Competence_Name, so I wrote {let $z:= max(for $Id in doc("/db/CMS_Project/trainers.xml")/Trainers/TrainerInformation/Competences where $Id/Competence_Name="Make appropriate use of technology tools" return $Id/Competence_Level)} and it returns -->2 -->4 and not the maximum number of the two., which is 4 Thank you for your help. |