View Full Version : Learning XML: Using data for simple calculations

10-19-2008, 02:29 PM
Hello everybody,

I am trying to learn XML but I'm blocked after the first steps. I have an high-intermediate knowledge of HTML and CSS, but I am absolutely blank on PHP and Javascript, and I know that what I'm going to ask here is probably involving the latter.

In any case, I succeeded in the simple steps of building a valid xml file, styling it with xls and displaying it correctly. Now I would like to play around a little bit more dinamically with the data stored in my XMLs.

What I am aiming to do is to let the user select a record inside a specific XML file so that only the selected record would be displayed; then, what I'd like is to select another set of data and let the two set interact in a third result.
Let's say that all the data contains nothing but numbers, I would like to select the first set of numbers, then the second set and thirdly display the result of a simple calculation (sum, subtraction, multiplication, fraction) between the data collected.

I know this should be something fairly simple, but I have no clue on how to move in the direction I want, that's why I'm posting to ask for your help.
Hope someone finds time to lend a hand,

Thank you in advance,

M. L.

10-19-2008, 04:19 PM
you can start by http://www.w3schools.com/xml/ and http://www.w3schools.com/xsl/

10-19-2008, 05:20 PM
Thank you for your reply.
I already went through both tutorials at W3Schools, and got a grasp on the various functions as well. But the problems for me remain all the same:
How can I dynamically access those data? I can of course display the data I need beforehand, but what if I want to change dynamically the data displayed with data from a whole different .xml file or from a different record on the same xml?
Moreover, how could I make simple calculations using the data stored within an XML? Do I have to use javascript? Or is there some other way?

Thank you again.

M. L.