XML and the Next Web (and the Previous...)

by Simon St. Laurent

XML has changed the Web dramatically over the last decade, though not at all as originally planned. XQuery, though, is gathering steam to drive a new round of potentially invigorating changes, even as Ajax heads down the JSON path.


M. David Peterson
2006-12-08 06:53:47
Hey Simon,

Nice write up! Theres only one thing that I disagree with, though only partially,

> XQuery also promises to flatten the tasks of collecting data and arranging it for presentation, because it's a transformation language (with the same capabilities as XSLT) as well as a query language. Instead of having to write SQL to get your data and code in another language that formats it, you can perform both steps in XQuery, if you want.

Unfortunately the transformation portion of XQuery doesn't work from a template perspective. WAY TOO MUCH code rewrite, and/or awkward imports are required to accomplish the reusable aspect that XSLT offers as its defacto foundation.

The solution?

Use XQuery to gain pinpoint precision access to the data you want, outputting the result in a "Lingua Franca" XML format of your personal choice. I personally think Atom provides a nice envelope format for both the over-the-wire and storage piece of the puzzle, but there are certainly others. In regards to the XML format of your choice, obviously this will be determined by the output needs -- If your documents are all web-based, then XHTML makes a lot of sense. If they're more document-oriented, the ODF or (possibly) OpenXML seem to be good candidates, ODF being the simpler of the two to groc.

With these in place, then converting from one format to another becomes nothing more than using reusable transformation files to convert from the storage format to the desired viewing format.

XSLT 2.0 offers some nice benefits in regards to managing the output into multiple document formats, as well as simplifying various pieces of XSLT (like grouping) that are EXTREMELY complex using XSLT 1.0. But EXSLT offers a lot of the same benefits (excluding multiple outputs as part of the same transformation process, though it wouldn't surprise me to see that change in EXSLT 2.0 if this were ever to become a reality (and I think it will)) and EXSLT has quite a few more implementations out there than does XSLT 2.0, though with Saxon/Saxon on .NET you gain the benefit of both XQuery and XSLT 2.0 as part of the same engine, so I'm not sure if that point is one that can be viewed as any sort of dividing line between whether XSLT 2.0 or EXSLT is the more practical of potential transformation solutions.

Of course, with all of this, this is only my own opinion. There are certainly other opinions, each of which have just as much validity, so for what its worth, there ya have it.

Thanks for the write up, Simon! Tons of great info in here to reference/learn from!

M. David Peterson
2006-12-08 10:38:39
One thing I should point out: I started writing this as a direct response, and then immediately turned it into a generalized response for follow-up readers. I probably came across as if I thought I was telling you (Simon) things you were obviously more than fully aware of. My apologies if it came across this way!
Michael Champion
2006-12-08 11:49:33
Simon optimistic about XML? Check the weather report in Hades! Watch out for flying pigs!

But seriously ... there seem to be two somewhat contradictory points here -- the rise of JSON and the maturation of XQuery. Doesn't the former undermine the importance of the latter? How can XQuery change the web if the Web consists of tag soup for humans and JSON for machines? Or will the availability of XQuery breathe new life into the "SGML for the Web" vision and we'll see a lot of XML that's worth querying and mashing up with XQuery?

I guess I forsee a world where XML and XQuery stand beside RDBMS and SQL behind the firewall, but it is still mostly HTML, JavaScript, and JSON exchanged over the public web. Despite Roger Bamford's prediction at XML 2006 http://2006.xmlconference.org/programme/presentations/163.html I don't think "XML + XQuery(P) + Apache + REST == no middle tier". Instead, we'll still have that middle tier speaking XQuery and SQL to the back end and HTML+JSON (and some XML like RSS/Atom) to the web clients. Sane people won't expose their XQuery stores over the web any more than they would expose their SQL stores over the Web.

2006-12-09 03:44:53
Mike has it right. Simple things tend to become complex when one of the fundamentals have to be optimized. I blogged that topic comparing the evolution of internal combustion engines and the demise of the shade tree mechanic along the way. The surprise for some will be the demise of the 'it must be simple' web developers for whom so much has been sacrificed.

For a decade, we spent our time trying to get SGML accepted by programmers. For our sins, we succeeded, perhaps and the bewildering families of reams of specifications were piled on top of that thin paper that was tossed onto the floor in '96. The secret was that nothing of much importance can be done with something that simple unless the other piles are created as well, or some practical applications are sacrificed.

At this point, I think it's easy to see that the struggle has shifted from web developers vs markup technologies to web developers vs programmers and that is a sea change most have yet to understand or talk about. When the internal combustion engine began to be optimized for weight and fuel consumption, none of the principles (fuel + fire + air in the right combination = power) really changed except 'the right combination' and 'the complexity of the engine needed to make it work. But the knowledge and skills required, the tools required, and the learning curve changed incredibly and the shade tree mechanic became an evolutionary dead end.

I think the big change coming is XAML, not XQuery. What is in play now is where Joe WebPage goes, what tools/objects are required, and if the web as the haven of 'web developer's over professional programmers' is a vanishing niche along with the XML conferences. Note the SGML conferences experienced a similar decline. If it follows the same path, it breaks up into conferences for each middle tier object required for each class of application language. XML knowledge is assumed the same way plumbers assume one can solder; just another tool and technique.

2006-12-09 08:45:10
David: Your suggestion (quite a good one) of using XQuery to assemble data and handing off that data for presentation transformation with XSLT was one of the lessons highlighted by Michael Kay's presentation on Meta-Stylesheets, which I described here.
M. David Peterson
2006-12-09 18:24:22

Thanks! (left additional comment at post)