aspose file tools
The moose likes XML and Related Technologies and the fly likes maths in XML ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "maths in XML ???" Watch "maths in XML ???" New topic
Author

maths in XML ???

rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
Somewhere on the web i read an example but I am unable to understand it. Can anyone help?

xml file

xsl file


Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
tony hutcheson
Ranch Hand

Joined: Dec 08, 2000
Posts: 38
I hope the following helps:
<xsl:template match="numbers"> indicates that we want to work with the <numbers> node(s).
After that is a list from A through N. The left of "=" describes what we want to do in terms that we can understand outside of xsl. The right of "=" shows how this is done in xsl.
For example:
<xsl:value-of select="x+y"/> says to take the value of the nodes <x> and <y> (remember we are dealing with children of <numbers> ), and add them together to get the desired result. In this case we would get an out put of 7.2.
I hope this helps.
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
Thanks for the explanation. But I can't get any output.
tony hutcheson
Ranch Hand

Joined: Dec 08, 2000
Posts: 38
I am not sure how to help you get output. I am fairly new to XML also, but I can tell you what I did.
I followed an example in "Beginning XML" from Wrox Press which instructed me to use XT, which is available from http://www.jclark.com/xml/xt.html, as the transformation engine. I then ran xt.exe from the command line:
xt <name of xml file> <name of xsl file> <optional: name of output file>
If you leave out the output file the result of the transformation will appear in the command prompt window. This worked for me and gave me the results I expected.
I would suggest finding a simple example of using XSLT in a book or on a website and try to duplicate it's results, then apply that to your xml and xsl files to see what happens.
Good luck!
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
"Match" example was described in Bob DuCharme's "Math and XSLT" article: http://www.xml.com/pub/a/2001/05/07/xsltmath.html
you cannot run it only with XML, you need some XSLT processor, for example XT, like Tony said.


Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
Thanks. The example cleared the doubts.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: maths in XML ???
 
Similar Threads
XSLT equality test
A doubt about Xpath expression
How to count ?
mixed output
Walk distinct values in xsl key 4 at a time