PDA

View Full Version : combine XML docs and find max...


bphein1980
11-22-2005, 11:34 PM
Hi,

I am building a website for my gym's powerlifting team to keep track of the member's lifts (squat, bench, and deadlift).

Currently, I have a few XML docs for each meet to store the lift data and display it with XSL. What I want to do is to be able to combine each of the XML documents and display only one line for each lifter with their biggest lift for squat, bench, and deadlift... all in one table.

Here are two examples of the XML files:

20051119.xml
<?xml version='1.0' encoding='utf-8' ?>
<meet
id="11192005"
what="2005 BIG IRON OPEN APF POWERLIFTING CHAMPIONSHIPS"
when="November 19, 2005"
where="Omaha, NE"
>
<flight type="Women Full">
<lifter bigiron="true">
<name>Heidi Burke</name>
<class>132</class>
<division>Open</division>
<squat>185.0</squat>
<bench>92.5</bench>
<dead>170.0</dead>
</lifter>
<lifter bigiron="true">
<name>Machia Dudley</name>
<class>198+</class>
<division>Teen</division>
<squat>70.0</squat>
<bench>153.0</bench>
<dead>195.0</dead>
</lifter>
</flight>
<flight type="Women Bench">
<lifter bigiron="true">
<name>Laura Schwartz</name>
<class>181</class>
<division>Open</division>
<squat>0</squat>
<bench>87.5</bench>
<dead>0</dead>
</lifter>
</flight>
... etc

20050402.xml
<?xml version='1.0' encoding='utf-8' ?>
<meet
id="04022005"
what="APF NEBRASKA/IOWA STATE and REGIONAL APF CHAMPIONSHIPS"
when="April 2, 2005"
where="Omaha, NE"
>
<flight type="Women Full Meet">
<lifter bigiron="true">
<name>Deb Widdis</name>
<class>198</class>
<division>Master I</division>
<age>43</age>
<squat>242.5</squat>
<bench>120.0</bench>
<dead>212.5</dead>
</lifter>
<lifter bigiron="false">
<name>Barb Sieps</name>
<class>97</class>
<division>Open</division>
<age>38</age>
<squat>130.0</squat>
<bench>65.0</bench>
<dead>138.0</dead>
</lifter>
<lifter bigiron="false">
<name>Rita Carlsson</name>
<class>148</class>
<division>Open</division>
<age>52</age>
<squat>137.5</squat>
<bench>62.5</bench>
<dead>160.0</dead>
</lifter>
<lifter bigiron="true">
<name>Tanya Vaught</name>
<class>198</class>
<division>Open</division>
<age>30</age>
<squat>182.5</squat>
<bench>105.0</bench>
<dead>192.5</dead>
</lifter>
<lifter bigiron="true">
<name>Ali Huston</name>
<class>181</class>
<division>Teen</division>
<age>19</age>
<squat>242.5</squat>
<bench>117.5</bench>
<dead>232.5</dead>
</lifter>
</flight>
<flight type="Women Push/Pull">
<lifter bigiron="true">
<name>Heidi Burke</name>
<class>132</class>
<division>Open</division>
<age>37</age>
<squat>0</squat>
<bench>75.0</bench>
<dead>155.0</dead>
</lifter>
<lifter bigiron="true">
<name>Machia Dudley</name>
<class>198+</class>
<division>Teen</division>
<age>18</age>
<squat>0</squat>
<bench>145.0</bench>
<dead>197.5</dead>
</lifter>
</flight>
...etc

I have multiple XML files that are set up the exact same way. How can I combine them and find each lifter's best lifts and display them in one table using XSL?

Alex Vincent
11-23-2005, 02:53 AM
First off, I really hope those aren't real names in the XML files.

Second, are you sure you want to use XML for this? XML is great for having a common format for exchanging data between applications, but it looks to me like a simple PHP/MySQL database operation would be more than adequate for what you want.

I'm not saying it's not doable. XMLHttpRequest is probably your friend if you go this route. I'm just saying it may be overkill.

Other thoughts:

Who's to say you can't combine the XML files on the server and send them as a combined set to the client as one XML document?

You may or may not need to have each property defined as a new element. For example:

<lifter bigiron="false" name="Joey Montana" ... />

The numbers you mention there are rather impressive. I've been working out for about six months, and I'm well aware of what I can do. I'm not at those levels, by any means.