Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
(TobyCabot - 12 Nov 2003)
We found out from the XmlCssExperiment that we can't expect to send XML and CSS to browsers and get good cross-browser results. Mozilla does a pretty good job, but IE doesn't. There's another approach, though: send an XML document with a link to an XSL stylesheet. The stylesheet transforms the XML document into HTML which the browsers seem to be better at displaying than raw XML.
Here's a document that includes a link to an XSL stylesheet:
<?xml version="1.0" ?> <?xml-stylesheet type="text/xsl" href="trivial.xsl" ?> <body> This is an XML document. It's well-formed but doesn't have a DTD so we can't say if it's valid or not. It also has a processing instruction that tells the browser how to find an XSL stylesheet with instructions how to transform the document into HTML. </body>The xml-stylesheet processing instruction tells the browser where to look for the stylesheet, which is a little more complex (since XSLT is pretty complex):
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||||||||
Deleted: | ||||||||
< < | <-- kludge for IE 5 and 5.5. IE6 and moz do this by default --> | |||||||
<-- The overall structure of a page --> ... <head> <title>Sample XML/XSL/CSS Page</title> <link rel="stylesheet" type="text/css" href="trivial.css"/> </head> ...You can see the result here. |