Arman's stuff
Guest
More about XSLT and SVG

(Thu Nov 19 17:57:31 2009)

The more I mess with XSLT, the more I like it.

Now, don't get me wrong, it's a bear to deal with, and it is mind-bendingly frustrating to try to think in a straight line, nevermind the weird syntax, and the fact that no two rendering agents get the same result...

At this point (at work), I'm so many languages deep that even I can't count them. For an *average* page, I'm using at least six languages (or at least "things with rules and a name"):
VB.Net, XML, XSLT, HTML, JavaScript, and CSS. In some pages, I'm using inline SVG, and in at least one page, I'm using a Java applet.

So, about XSLT. It basically translates XML into more XML. However, that means you could take a file with plain, ugly XML in it, and convert it into a webpage complete with JavaScript. Like I said, very powerful... I'm currently using it to make a javascript-enabled webpage with embedded SVG (or flash, if you are silly enough to use IE). It's a report with a summary page, a graph page, and a data page; three buttons at the top of the page will show/hide each section. Thus, clicking "graphs" will show the graphs page (or tab, as I suppose it should be called).

So, what have I learned today? Lots of stuff - inline SVG doesn't work on IE, even with plugins, but if you use svgweb and convert it to flash first, it works great. Also, I reinforced the concept that "headers are important" - if the page headers are text/html, the page doesn't render in Opera or Firefox. If the page headers are application/xhtml+xml, the world is great. Except in IE, because it doesn't know what to do with those headers. Sigh...

So, anyway, my webpages (at work) are coming together, and that which I've learned will definitely apply towards my own page. I'd like to get this XSLT stuff working - at this rate, I'll be able to rewrite all my pages with a single XSLT, instead of a bunch of nasty other stuff. And then there's SVG... now that's just plain awesome. Text-based images with XSLT? Oh yeah. Nice. Add in CSS, and everything is gold.

For example: say you have a webpage, and you've designed a great template for it, but you'd like to give your users the ability to change colors. You set up a few color schemes that look nice, but there's really no way to send these colors on to the page without making new images for each page. Sure, you're only using four images, but man, if only you could style them with CSS... well, with SVG, you can! The same CSS file that styles your main page can style the inline SVG, no problem! So you want to change the colors? Have one main CSS file, and a lot of little "color information only" CSS files. To change the colors, change the secondary files. It's that easy!

And did I mention that SVG can be animated?

<< Fog ConvictChrome OS >>

This blag is tagged: Programming, Svg, Xslt, All