xsl-list
[Top] [All Lists]

[xsl] Client-side XSLT (was: Modern web site design with XML and XSLT)

2010-01-06 11:50:58
Eric J. Bowman wrote:
browsers from 6 up have MSXSLT, but you have to call it from
Javascript since there's no application/xhtml+xml support in IE
(and not likely to arrive before IE 13 at this rate...).

David Carlisle answered:
If you are using client side xslt then can't you can just serve as
application/xml which IE does work, and use the xml-stylesheet pi to
link to the xslt?

Eric J. Bowman wrote:
There is no such workaround in IE, that I know of, that doesn't either
break the "back" button or throw the browser into quirks mode

From this last answer, both assertions are incorrect, even if the
second one seems to be especially popular.

You might check the example below from the local file system or from
the server by using application/xml. The syntax used is XML with no
need for _any_ special (HTML) cases here, so an empty div element is
simply written as <div/> for example!

With IE6 it will be rendered in strict mode, despite the XML prolog.

With Firefox it will give you a XHTML document. You can check this by
viewing the DOM.

For the only "problem" I'm aware of (doubling the <br/> in Opera, IE6
and IE7) I have included a workaround in the stylesheet.

So I would propose, instead of sending browser specific html, to send
a single XML and let the browsers XSLT machine take care of its
specific needs. Is it too simple? Please criticise!

Best Regards,
Manfred

test.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="identity.xsl" type="text/xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml";>
   <head>
      <title>resr quirks-mode</title>
      <style>
div {
   margin: 20px;
}
.testbox {
   width: 200px;
   padding: 20px;
   border: 1px solid #000000;
}
.comparisionbox {
   width: 200px;
   border: 1px solid #000000;
}
      </style>
   </head>
   <body>
      <div id="main">
         <p class="comparisionbox">This paragraph has width: 200px and
no padding. It always remains exactly 200px wide, regardless of
rendering mode.</p>
         <p class="testbox">This paragraph has width: 200px and
padding: 20px. Which box model does it follow?</p>
         <p>Note: This is a variation after a <a
href="http://www.quirksmode.org/css/modes/box_quirks.html";>page at
QuirksMode</a></p>
      </div>
   </body>
</html>

identity.xsl:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
   xmlns:html="http://www.w3.org/1999/xhtml";
   exclude-result-prefixes="html"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html"
   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
   omit-xml-declaration="yes" indent="no"/>
<xsl:template match="/">
   <xsl:apply-templates/>
</xsl:template>
<xsl:template match="@*|node()">
   <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
   </xsl:copy>
</xsl:template>
<xsl:template match="html:br">
   <br xmlns=""/>
</xsl:template>
</xsl:stylesheet>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] Client-side XSLT (was: Modern web site design with XML and XSLT), Manfred Staudinger <=