Why aren't more webpages written using XML with an XSLT stylesheet? For separating content from presentation, this combined with CSS would be even more powerful. Right now, for things like outputting a navigation menu, people often hand-copy the navmenu code from page to page or do something like
<?php include_once('myheader.inc'); ?>
on every page, which not only puts more demand on the server, but results in duplicated data transmitted.
When I was introduced to it, I was told that all major browsers back to IE6 support XSLT 1.0... are there unresolvable bugs between implementations? Are there others showstoppers or severely lacking features that are inhibiting the spread of XML+XSLT? The only website I've seen lately that is XML+XSLT is starcraft2.com.
XSLT is very widely used. As far as we can judge from metrics like the number of StackOverflow questions, it is in the top 30 programming languages, which probably makes it the top data-model-specific programming language after SQL. But XSLT isn't widely used client-side, that is, in the browser.
The Extensible Stylesheet Language Transformation (XSLT) standard specifies a language definition for XML data transformations. XSLT is used to transform XML documents into XHTML documents, or into other XML documents.
XSLT brings XML, schemas, and XPath together in a declarative programming language. It is used to query and transform XML (and, with XSLT3, JSON) data, enabling one to express data in new ways, or to create new data based on the content or structure of existing data.
If your XML maps pretty nicely to individual layout elements then use CSS, if you need more work in adapting it for display, then use XSLT. Things like arbitrary re-orderings of content or collapsing multiple lists of values into a table, etc. don't lend themselves well to CSS.
However most of all (IMHO) it adds an extra layer to the process that doesn't "buy" you much.
e.g. typically you have:
DB > SQL > [JAVA|PHP|ASP|Python|Ruby] > HTML
but if you throw XML and XSL in, you've added steps that (can be) hard to justify
DB > SQL > [JAVA|PHP|ASP|Python|Ruby] > XML > XSL > HTML
having the data in a handy dandy universally exchangeable XML format is great-n-all, but unless you need it, all you've done is add steps.
Now I shouldn't knock XSL too much because, well I use it all the time and do appreciate some of the powerful options it provides. However to anyone deciding if they want to use it, be sure you have a need before diving in.
Blizzard Entertainment seems to like XSLT. Their World of Warcraft Armory site is completely implemented using it. Look around the site using view source.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With