It's not a secret anymore!*
The moose likes XML and Related Technologies and the fly likes XSLT vs JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSLT vs JSP" Watch "XSLT vs JSP" New topic
Author

XSLT vs JSP

Mathew Kuruvilla
Ranch Hand

Joined: Nov 27, 2001
Posts: 135
If I have an XML document, and I want to generate a graph out of the data in the XML document, is it better and/or easier to use XSLT or JSP.
Thanks.
Mathew
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
What do you mean by "a graph"?
There was a nice holy war "XSLT vs. JSP" in this forum, maybe you'll find something useful there.
Mathew Kuruvilla
Ranch Hand

Joined: Nov 27, 2001
Posts: 135
A graph as in plotting a variable X versus a variable Y and displaying them on a 2D coordinate system.
I would not mind displaying the information as bar graph either.
Thanks.
Mathew
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
This doesn't sound as a good fit for XSLT. XSLT transforms an input XML into another XML, plus it adds any text you put between its tags. You will have a text file as an output, apparently it's not what you need. JSP would be a better choice.
Mathew Kuruvilla
Ranch Hand

Joined: Nov 27, 2001
Posts: 135
What about SVG vs JSP. SVG => Scalable Vector Graphics. I have no idea what this is. I just came across this acronym when I was looking for generation of charts. Really, I know only what JSP is capable of because I know what Java is capable of. I don't even fully know what HTML is capable of.
Mathew
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Hm... How do you need to display your graph? In a browser? In a standalone Java application? How pretty the output should be? If you can live with bunch of '********' then even HTML will work
SVG is anXML-based format for graphic representation. There are some good examples here: http://www.zvon.org/HowTo/Output/
[ April 20, 2002: Message edited by: Mapraputa Is ]
Mathew Kuruvilla
Ranch Hand

Joined: Nov 27, 2001
Posts: 135
How the output is generated is unimportant, and that is exactly what I am trying to determine. Prettiness is.
Thanks.
Mathew
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
"How the output is generated is unimportant" - but do you show it via browser or not? I believe, to see SVG pictures your users will have SVG viewer plugged in. Can you rely on this? If it is an educational project, then you do not have to worry about acessibility issues too much, if you are in so-called "real world" :roll: you have. Do not listen to what another moderator of this forum will tell you, as a programmer you have to program out of context. For example, (for "real world" situation only), now your requirements look simple, but what are chances that it will grow into something bigger and prettier, and prettier? Java is probably more scalable and reliable technology in this respect. Then, does this project have a chance to outlive you? I mean, wil other people have to maitain it? If so, than Java skills are probably easier to find than XSLT/SVG skills.
I am not sure how you can use JSP to show graphs, usually applets are used for graphic works. Another way is to generate a picture in JPEG format,here you can read how
What is easier... It's hard to say. With XSL you will have to learn
1) how to get your data out of XML doc (this part is easier with XSLT than with Java, IMHO)
2) how to output them - here you need to learn SVG format, or, alternatively, XSL-FO
With Java you will need to learn
1) how to get your data out of XML doc with parsers (IMHO XSLT way is easier)
2) how to output them - i.e. Java classes from standard distribution or maybe even specialized package if you need particularly fancy graphics
I would say if you want quick, small, simple solution, than XSLT/SVG should work, but Java way is more flexible and scalable in all possible directions.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Map! I find it hard to believe you are serious about using XSLT on this problem.
Typically the first step in graphing is to run through the data and get the range of values that have to be displayed. Next you have to scale to the presentation method.
How in the world would you do all these numeric manipulations in XSLT??
Bill
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
From theoretical point of view, XSLT is Turing-complete, so everything is possible with XSLT. Of course, it doesn't means that everything is easy with XSLT.
Mathew was talking about "plotting a variable X versus a variable Y" - which doesn't look too complex. Here is an article with some examples how it may look like.
But if would be better if we had more information, like an example of input XML document. How fast presentation should work? XSLT can be too slow...
When I was learning English, we asked out teacher "how to say this word in English" and she always answered "What do you want to say? Say the whole sentence!" - because too much depends on context. It's the same with a choice of technologies. I was trying to keep XSLT as a possible solution only if the problem is really small and simple.
Thank you for calling me "Map"!
[ April 22, 2002: Message edited by: Mapraputa Is ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XSLT vs JSP