Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Applying CSS to client-side transformed pages [Thread Next] Re: Applying CSS to client-side transformed pagesTo: 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/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
