This post contains attachments v20020307073628.zip 
Summary
Using XSLT to produce a simple graph from XML data.
To try this code in Xselerator, please install the 30 day demo version of MarrowSoft
Xselerator.
I must confess - I think SVG is one of the greatest things since sliced bread! :-)
Combining the power of SVG with the capabilities of XSLT to produce dynamic graphics (e.g. graphs) from XML data is truly excellent - we just need to wait for SVG to be more widely supported by browsers (by default - at the moment it can only be done with the use of plug-ins, e.g. the Adobe SVG Viewer http://www.adobe.com/svg/viewer/install/main.html).
So I've been having a play with using SVG in combination with XSLT to produce some very rudimentary graphs. I'm no SVG whiz so my SVG code may not be the best - and I'd appreciate comments if any experts out there can see that my SVG coding is way off beam!
The one small complaint I have with SVG is the @d attribute of the <svg:path> element - I have found the commands to be used in this attribute a little hard to write and even harder to read. My wish for SVG is that the path definitions be more XML like, for example rather than...
<svg:path d=M 20,10 h10 v10 h-10 v-10/>
I would rather do something like...
<svg:path> <svg:d movetoX=20 movetoY=10/> <svg:d linetoX=10/> <svg:d linetoY=10/> <svg:d linetoX=-10/> <svg:d linetoY=-10/> </svg:path>
Yes, it would be more verbose - but a lot easier to write and read (and correct). Maybe this is something that has been addressed in SVG1.1 - but I couldn't see any direct evidence of it.
Anyway, my rudimentary attempts are shown below - do let me know what you think.
Cheers - Marrow
|