• Post Reply Bookmark Topic Watch Topic
  • New Topic

maths in XML ???  RSS feed

 
rani bedi
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Somewhere on the web i read an example but I am unable to understand it. Can anyone help?

xml file

xsl file
 
tony hutcheson
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the explanation. But I can't get any output.
 
tony hutcheson
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
rani bedi
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. The example cleared the doubts.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!