Anyone using XML + XSL (or CSS) for pages?

P

Pat

Is anyone using XML instead of HTML for pages of content? If so is
there a public site to browse? Can someone point me to a discussion
of the pros and cons of doing this? I am trying to get a handle on
how close XML is to replacing HTML for browsing specifically (I am
aware of its other benefits.) Also I do understand that XML can be
transformed into HTML but would rather not do this for various
reasons.
 
J

Johannes Koch

Pat said:
Is anyone using XML instead of HTML for pages of content? If so is
there a public site to browse? Can someone point me to a discussion
of the pros and cons of doing this? I am trying to get a handle on
how close XML is to replacing HTML for browsing specifically

You could use some kind of XML and CSS for presenting content. But there
are quite some user agents that don't support XML. And there are even
more that don't support additional things like XLink (for navigation) or
XForms (for form applications).
 
A

Andy Dingley

Is anyone using XML instead of HTML for pages of content?

Yes and no. Did that about 5 years ago, still can't do it for
widespread use on a public site, owing to the limited number of user
agents that can handle it.

It may have intranet uses, but for public access I think you either
need to avoid it, do it server-side, or browser-sniff and behave
accordingly.

There's also the problem that page load is ugly on a big page. It's a
white screen until the XML document is down, the XSLT is down, and the
transform has been run. If you must do this sort of client-side XSLT,
then use the "data island" approach and client-side JavaScript / DOM
that shows a plain HTML page with a "Loading..." banner, loads the XML
& XSLT as either linked or embedded resources, then transforms one
with the other and writes it into a HTML <div>. Still browser
dependent, but it's a better implementation.

These days almost everything I write is server-side XSLT generated. If
I'm doing some complex data-navigation example (clickable table
columns to sort, that sort of thing) then I might use XSLT on the
client.

Even better is the combined approach. Write your document as _both_
XML and HTML - write it as XHTML, but in such a way that it also
contains all the data that the original XML document contained
(qualified <span>s will be helpful). Now a non-XSLT browser renders it
as the page you forst wrote, but an XSLT-capable browser has the
chance to use this as an XML source document, hide it from display,
and re-create a new display version with whatever processing you wish.

That said, there are sometimes uses for XML+XSLT directly to the
browser - when you're writing XML that isn't targetted at a browser or
human, but you need to view it for debugging. This week I'm writing
PartnerML for mobile phones. An ugly XML-based metalanguage (the phone
network stack later transcodes this into either XHTML-MP or WML, as
needed by the handset). It's a nightmare to debug, because you have to
run it through the network stack to get it into a viewable fashion.
Instead, my server does browser-sniffing and if it recognises the user
as my dev desktop running IE, it sends me an XSLT stylesheet as well
that emulates the network stack and a phone browser.


Pure XML + CSS is useless. No ability to generate elements, manipulate
atrributes, to transform ordering, or to duplicate existing elements.
Use XSLT instead.
 
W

Wired Earp

Andy said:
Pure XML + CSS is useless. No ability to generate elements, manipulate
atrributes, to transform ordering, or to duplicate existing elements.
Use XSLT instead.

Mozilla has very strong support for pure XML [and real XHTML], including
all of the above, check out <utl:http://www.mozilla.org/university/hof.xml>
for a quick example. Non-standard XML markup should be avoided anyhow, for
reasons of compatibility and accessability.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,828
Latest member
LauraCastr

Latest Threads

Top