distinguishing between presentational and transformational stylesheets
Myk Melez <[email protected]> Thu, 11 Jan 2007 16:41:42 -0800
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | mozilla.org |
| Message-ID | <[email protected]> |
[I filed bug 366746 <https://bugzilla.mozilla.org/show_bug.cgi?id=366746> on this proposal but thought it might be useful to generate discussion in this group, so here's what I wrote in the bug.] XSLT stylesheets seem to be used in two relatively distinct ways: 1. to format/style data for presentation to users; 2. to process/transform data for input into applications. It would be useful to distinguish between these two uses so that Gecko-enabled applications can selectively apply stylesheets depending on whether or not the XSLT-processed data documents they load are being presented to users. For example, when the microsummary service in Firefox retrieves web pages in order to extract microsummaries from them, it treats those pages as sources of data, not documents to be displayed to users. So it would make sense for the service to apply transformational but not presentational stylesheets to those pages. Jonas Sicking has suggested that this could be accomplished either by using separate processing instructions for the two cases or by adding an attribute to the "xml-stylesheet" processing instruction to identify the purpose of the stylesheet. Presumably Gecko would always apply transformational stylesheets when loading documents (as both uses require the data to be transformed into its final form) but only apply presentational stylesheets for documents being displayed to users, so both kinds of stylesheets would be applied to XML documents loaded into a Firefox browser tab, but only transformational stylesheets would be applied to data loaded via XMLHttpRequest. But perhaps it would be useful to allow calling code to specify which kinds of stylesheets to apply when initiating a load, if there are edge cases which deviate from this pattern. As an aside, I wonder if this facility could also be used to resolve the conflict between Firefox developers and some site authors over Firefox's behavior around site-provided stylesheets for feeds. Briefly, Firefox ignores such stylesheets when presenting users with a feed reading interface to feeds, because the vast majority of those stylesheets exist solely to improve the presentation of those feeds in browsers that don't support feed reading. But a few sites use feeds and XSLT as two layers in the technology stack by which they construct web applications, and they resent having to employ hacks to prevent Firefox from breaking those applications by ignoring one component in that stack because it erroneously sees the feed document as "just a feed" with a presentational stylesheet. Perhaps those sites could use this facility to identify their stylesheets as transformational, thus triggering Firefox to apply those stylesheets without the need for hacks, while Firefox continues to appropriately ignore presentational stylesheets when presenting "just a feed" feeds to users.