Advertisement

05.10.2004 at 11:50AM PDT, ID: 20984370
[x]
Attachment Details

XSL / Xpath - urgent - totalling/comparing/ordering

Asked by RichardWhitehouse in Extensible Markup Language (XML)

Tags: totalling, xml, xpath

Here is my data document

<?xml version="1.0" ?>
 <questionnaire AssessInd="Some Person" ProjectID="4">
  <user id="2" position="somePosition" fname="Bruce" lname="Dickinson">
  <cluster id="1" cdid="1" ccomp="2">
   <title>Topic Area1</title>
   <comment>comments on this topic here</comment>
   <question id="1" qdid="1" qcomp="1">
    <content>A question goes here</content>
    <answer>
     <importance>5</importance>
     <actual>5</actual>
    </answer>
   </question>
   <question id="2" qdid="2" qcomp="1">
    <content>A question goes here</content>
    <answer>
     <importance>5</importance>
     <actual>6</actual>
    </answer>
   </question>
   <question id="20" qdid="3" qcomp="1">
    <content>A question goes here</content>
    <answer>
     <importance>6</importance>
     <actual>5</actual>
    </answer>
   </question>
  </cluster>
  <cluster id="2" cdid="2" ccomp="2">
   <title>Topic title 2</title>
   <comment>comments for this topic</comment>
   <question id="25" qdid="4" qcomp="1">
    <content>A question goes here</content>
    <answer>
     <importance>5</importance>
     <actual>4</actual>
    </answer>
   </question>
   <question id="26" qdid="5" qcomp="1">
    <content>A question goes here</content>
    <answer>
     <importance>5</importance>
     <actual>4</actual>
    </answer>
   </question>
   <question id="40" qdid="6" qcomp="1">
    <content>A question goes here</content>
    <answer>
     <importance>5</importance>
     <actual>5</actual>
    </answer>
   </question>
  </cluster>
  </user>
 <user id="7" position="somePosition" fname="Barry" lname="White">
  <cluster id="1" cdid="1" ccomp="2">
   <title>Topic Area1</title>
   <comment>comments on this topic here</comment>
   <question id="1" qdid="1" qcomp="1">
    <content>A question goes here</content>
    <answer>
     <importance>5</importance>
     <actual>5</actual>
    </answer>
   </question>
   <question id="2" qdid="2" qcomp="1">
    <content>A question goes here</content>
    <answer>
     <importance>5</importance>
     <actual>6</actual>
    </answer>
   </question>
   <question id="20" qdid="3" qcomp="1">
    <content>A question goes here</content>
    <answer>
     <importance>6</importance>
     <actual>6</actual>
    </answer>
   </question>
  </cluster>
  <cluster id="2" cdid="2" ccomp="2">
   <title>Topic title 2</title>
   <comment>comments for this topic</comment>
   <question id="25" qdid="4" qcomp="1">
    <content>A question goes here</content>
    <answer>
     <importance>6</importance>
     <actual>4</actual>
    </answer>
   </question>
   <question id="26" qdid="5" qcomp="1">
    <content>A question goes here</content>
    <answer>
     <importance>4</importance>
     <actual>4</actual>
    </answer>
   </question>
   <question id="40" qdid="6" qcomp="1">
    <content>A question goes here</content>
    <answer>
     <importance>5</importance>
     <actual>3</actual>
    </answer>
   </question>
  </cluster>
  </user>
</questionnaire>

Above xml is a snippet of my data document.
There will possibly be many more USER elements with many more CLUSTER elements with many more QUESTION and ANSWER elements.

The doc will most likely have about 15 user elements around 20 - 40 question elements which remain the same for each user, only the answer section will be different as it contains their answers.

There should be enough above for you to see how a bigger version of the same doc will look.

What I want to do is output the top 5 questions from all the user nodes firstly assessed on the data in the question/answer/importance element. (a number between 1 and 6)

Then the same again but assessed on the question/answer/actual element. (a number between 1 and 6)

Then I would like to also select the bottom 5 questions from all the users..
again firstly assessed on question/answer/importance followed by question/answer/actual

So what id like to end up with is 4 ordered lists showing the question (question/content) and the topic title (cluster/title) of the top five created from the importance, top 5 from the actual, bottom 5 from the importance and bottom 5 from the actual.

Can anyone help me with this? It’s urgent, hence the 500pts.
Start Free Trial
[+][-]05.10.2004 at 06:11PM PDT, ID: 11036338

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.11.2004 at 01:48AM PDT, ID: 11038464

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.12.2004 at 10:23AM PDT, ID: 11052083

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.12.2004 at 01:13PM PDT, ID: 11053488

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2004 at 06:39AM PDT, ID: 11058997

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.13.2004 at 08:17AM PDT, ID: 11060033

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2004 at 08:23AM PDT, ID: 11060108

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.13.2004 at 08:53AM PDT, ID: 11060404

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Extensible Markup Language (XML)
Tags: totalling, xml, xpath
Sign Up Now!
Solution Provided By: conorj
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.13.2004 at 01:49PM PDT, ID: 11063306

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.24.2004 at 02:25AM PDT, ID: 11141450

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32