[webkit-help] XSLTProcessor: transformToFragment returns HTMLElement even with method="xml"

Gregoire webkit-help at artefarita.com
Sun Sep 12 06:36:41 PDT 2010

Hi again,

I've created a test-case so that it is easier to answer my question.

The included files are a XForms application. So, for this test-case to
work, you need to download XSLTForms from the "XML Data Island" branch,
with the following svn command:

svn -r 448 co

Put the attached files "test-chrome-xslt.xml" and "test-chrome-xslt.js"
in the directory containing the "xsltforms-data-island-448" directory.
Then open the file in both Firefox and in a WebKit based browser (it
seems necessary to open the file through a local web server with WebKit,
otherwise you get a blank white screen).

In the debugger, add a watch expression on
"myInstance.childNodes[0].childNodes", and put a breakpoint on line 12
of "test-chrome-xslt.js".

Then click in the drop-down menu. You will see:
which is normal because it is before the sorting.

After a second click in the drop-down menu, you will see:

And then everything will disappear because "transformToFragment" (line
20) doesn't seem able to work with "HTMLElement"s.

If this is a bug, please tell me and I will fill a bug report.


Le 12/09/2010 13:29, Gregoire a écrit :
> Hi,
> I'm trying to sort a XML Data Island using XSLTProcessor. My XSL is:
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="">
>   <xsl:output method="xml" encoding="utf-8"
>               omit-xml-declaration="yes" indent="no"/>
>   <xsl:strip-space elements="*"/>
>   <xsl:template match="/dummy">
>     <xsl:apply-templates select="announce[position() > 1]">
>       <xsl:sort data-type="number" select="price" order="ascending"/>
>     </xsl:apply-templates>
>   </xsl:template>
>   <xsl:template match="*|@*|text()">
>     <xsl:copy>
>       <xsl:apply-templates select="*|text()|@*"/>
>     </xsl:copy>
>   </xsl:template>
> </xsl:stylesheet>
> As you can see, I use the method="xml" attribute in <xsl:output>. In
> Firefox, using method="xml" returns Element nodes and the program works
> as expected (I can sort any number of times the XML Data Island).
> However, WebKit's implementation of "requestToFragment" seems to always
> return HTMLElement nodes, and after the first sort which works ok (but
> transforms my Elements to HTMLElements), it always return an empty
> nodeset (as if HTMLElements weren't found by the above XSL).
> Is it possible to tell WebKit's XSLTProcessor to return Elements instead
> of HTMLElements? If so, what could be the problem with my XSL stylesheet?
> Thanks!
> Gregoire

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-chrome-xslt.xml
Type: text/xml
Size: 3020 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20100912/49b13de1/attachment.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-chrome-xslt.js
Type: application/javascript
Size: 1916 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20100912/49b13de1/attachment.bin>

More information about the webkit-help mailing list