Bug 10462 - XMLHttpRequest does not respect xml-stylesheet
Summary: XMLHttpRequest does not respect xml-stylesheet
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 420+
Hardware: Mac (PowerPC) OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-17 10:54 PDT by Jake Devine
Modified: 2006-11-12 02:57 PST (History)
1 user (show)

See Also:


Attachments
The XML document listed in the description. (207 bytes, application/xml)
2006-08-17 11:35 PDT, Jake Devine
no flags Details
The XSL document listed in the description (There were typos in the listing that are corrected here) (456 bytes, application/xml)
2006-08-17 11:35 PDT, Jake Devine
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jake Devine 2006-08-17 10:54:53 PDT
The XML Document returned is original, untransformed, document at the location specified by the URL.

It doesn't look like I can attach files to this bug, but I'll give you a quick example:

xmldoc.xml:
--------------
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="xsldoc.xsl"?>
<page>
  <paragraph>
    <line>This is line one.</line>
    <line>This is line two.</line>
  </paragraph>
</page>

xsldoc.xsl:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="text" omit-xml-declaration="yes" />
  
  <xsl:template match="//page">
    <xsl:for-each select="paragraph">
      <p>      
        <xsl:apply-templates />
      </p>
  </xsl:template>
  
  <xsl:template match="line">
    <br>
      <xsl:value-of select="."/>
    </br>
  </xsl:template>
</xsl:stylesheet>
-------

When I enter the url for xmldoc.xml into the browser, i get the result of the transformation, however requesting it in an XMLHttpRequest just returns xmldoc.xml as an xml document.
Comment 1 Jake Devine 2006-08-17 11:35:05 PDT
Created attachment 10096 [details]
The XML document listed in the description.
Comment 2 Jake Devine 2006-08-17 11:35:56 PDT
Created attachment 10098 [details]
The XSL document listed in the description (There were typos in the listing that are corrected here)
Comment 3 Dave Hyatt 2006-08-17 16:13:30 PDT
I didn't think transforms would be auto-applied to XMLHttpRequests.  Does Firefox respect this?
Comment 4 Dave Hyatt 2006-08-17 16:14:47 PDT
It's not clear to me that we should respect this.... since I would think you'd want the source doc rather than the result doc (XSL can transform you to plain text or HTML as well, and that seems really strange to me if you could get that kind of transformed result from XMLHttpRequest).
Comment 5 Jake Devine 2006-08-17 16:33:01 PDT
Firefox doesn't support this, unfortunately.  Your recent addition of the XSLT processor makes this sort of moot (and hooray!), but I was just trying to work around the absence of browser-side transformations.

I don't think that it would be totally unexpected behaviour, however.  XMLHttpRequest already handles both text and XML data in response*, so either of those output methods could be interpreted.

In any case, I can certainly appreciate not breaking compatibility with Mozilla in this regard, and since browser side XSL is in the nightlies, it's certainly nothing important.
Comment 6 Alexey Proskuryakov 2006-11-12 02:57:25 PST
Closing as invalid per comments 4 and 5.