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

Gregoire webkit-help at artefarita.com
Sun Sep 12 04:29:39 PDT 2010


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


More information about the webkit-help mailing list