Bug 9901 - XSLTProcessor cannot parse text nodes for INPUT ELEMENTS in an XSLT stylesheet
Summary: XSLTProcessor cannot parse text nodes for INPUT ELEMENTS in an XSLT stylesheet
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords: HasReduction
Depends on: 5446
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-13 14:37 PDT by JB Smith
Modified: 2007-01-12 06:58 PST (History)
2 users (show)

See Also:


Attachments
testcase9901.dmg (78.02 KB, application/octet-stream)
2006-07-14 16:42 PDT, JB Smith
no flags Details
more reduced test (1.68 KB, application/zip)
2006-07-26 09:42 PDT, Alexey Proskuryakov
no flags Details
proposed fix (3.94 KB, patch)
2006-07-26 13:22 PDT, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description JB Smith 2006-07-13 14:37:48 PDT
If XSLTProcessor is given a stylesheet that would generate text nodes for an INPUT ELEMENT, it fails with no error thrown.  
Comment 1 Alexey Proskuryakov 2006-07-14 14:21:10 PDT
This needs a test case.
Comment 2 JB Smith 2006-07-14 16:42:56 PDT
Created attachment 9455 [details]
testcase9901.dmg

Attached is a complete testcase reduction for this particular BUG.  Copy the contained tescase9901 folder into a test webserver's content directory and browse to it to get started.
Comment 3 Alexey Proskuryakov 2006-07-25 14:09:02 PDT
The stylesheet fails to load:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns="http://www.w3.org/1999/xhtml">
  <xsl:output encoding="ISO-8859-1" omit-xml-declaration="no" method="html" indent="yes"/>
...
        <input name="e164_id" class="item" readonly="readonly" type="text" id="country.e164_id" value="{$e164_id}">textnode_that_will_fail</input>

As far as I can tell, xmlns="http://www.w3.org/1999/xhtml" has no business being here, and removing it (or even changing to xmlns="aaa") fixes the symptom. But I do not see why it has such an effect (of course, the <input> element should be empty in XHTML, but that doesn't explain the behavior IMHO).
Comment 4 Alexey Proskuryakov 2006-07-26 09:42:13 PDT
Created attachment 9699 [details]
more reduced test
Comment 5 Alexey Proskuryakov 2006-07-26 13:22:16 PDT
Created attachment 9702 [details]
proposed fix

Make sure to write a closing tag if an element has child nodes, to make the output valid XML. We don't care that HTML may forbid the closing tag if the element in question has child nodes.

It's a bit surprising that XSLTProcessor goes from DOM to XML document via a serialized representation (though this helped to find this bug :) ).
Comment 6 Darin Adler 2006-07-26 13:50:05 PDT
Comment on attachment 9702 [details]
proposed fix

r=me
Comment 7 Alexey Proskuryakov 2006-07-26 21:25:38 PDT
Committed revision 15645.