Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Applying CSS to client-side transformed pages

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 4/2/2006 2:09:00 PM



Simon Brooke wrote:

> (i) How do I know whether the client can do transforms? Currently I'm
>     only passing the transform to the client if the client sends an
>     'Accepts' header which contains either 'application/xml' or
>     'text/xml'. However, Internet Explorer 6, which apparently can do
>     transforms client side, doesn't send either of these.

I don't think the HTTP Accept header helps. In the end there is nothing 
very reliably that you could do, sniffing the user agent to try to 
identify the browser and compare against a list of XSLT capable browsers 
you keep is one approach but for various reasons user agent strings are 
changed to spoof certain browsers.

And if someone installs e.g. MSXML 3 with IE 5 or IE 5.5 then those 
browser support client-side XSLT but their user agent string will not be 
different from the original installation of IE 5 or 5.5 not supporting XSLT.

What you could try is to only rely on client-side XSLT run by script and 
not run by <?xml-stylesheet?>, with client-side JavaScript you can 
nicely check whether certain objects (e.g. XSLTProcessor) are exposed in 
the current user agent.

But as IE/MSXML's API to run XSLT transformations is much different from 
the API Mozilla provides writing script for both is tedious and 
cumbersome (Mozilla allows you to transform to DOM nodes to be inserted 
with W3C DOM methods, MSXML allows you to transform to string only to be 
inserted with e.g. innerHTML IE's proprietary DOM).

Furthermore I think Safari supports client-side XSLT with 
<?xml-stylesheet?> but so far does not expose an API to script to run 
transformations.

As you are starting with a working solution doing XSLT on the server and 
the way to client-side XSLT is difficult I would rather stay on the server.

> (ii) When the transforms transform XML to HTML which includes a link to a
>     CSS stylesheet, the visual appearance (in Firefox, anyway) which
>     results from a client-side transform is quite different from that
>     which results from a server-side transform, and it appears that the
>     CSS styling is being applied before the XSL transform is complete.
>     How can I ensure that the CSS is applied to the completed page?

That sounds odd, do you have a simple test case where that fails? Of 
couse it could be simply CSS differences depending on whether Firefox 
renders in quirks mode or in standard compliants mode (where there are 
differences whether the HTML html element or the body element are the 
canvas). Thus if you have e.g.
   body { background-color: green; }
doing
   html, body { background-color: green; }
could help.

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent