[webkit-changes] cvs commit: WebCore/layout-tests/fast/xsl
xslt-text-expected.checksum xslt-text-expected.png
xslt-text-expected.txt xslt-text.xml xslt-text.xsl
Darin
darin at opensource.apple.com
Sat Sep 24 03:07:09 PDT 2005
darin 05/09/24 03:07:09
Modified: . ChangeLog
khtml/xsl xslt_processorimpl.cpp
Added: layout-tests/fast/xsl xslt-text-expected.checksum
xslt-text-expected.png xslt-text-expected.txt
xslt-text.xml xslt-text.xsl
Log:
Reviewed and landed by Darin.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5039
XSLT text output doesn't work
Test cases added:
* layout-tests/fast/xsl/xslt-text.xml: Added.
* layout-tests/fast/xsl/xslt-text.xsl: Added.
* layout-tests/fast/xsl/xslt-text-expected.checksum: Added.
* layout-tests/fast/xsl/xslt-text-expected.png: Added.
* layout-tests/fast/xsl/xslt-text-expected.txt: Added.
* khtml/xsl/xslt_processorimpl.cpp: (DOM::XSLTProcessorImpl::documentFromXMLDocPtr):
Use text rather than CDATA, using entities for & and < so that we can parse no matter what
characters are in the text. Also add a head and a title element so the document is well formed.
Revision Changes Path
1.156 +18 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -r1.155 -r1.156
--- ChangeLog 24 Sep 2005 09:49:10 -0000 1.155
+++ ChangeLog 24 Sep 2005 10:07:07 -0000 1.156
@@ -2,6 +2,24 @@
Reviewed and landed by Darin.
+ - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5039
+ XSLT text output doesn't work
+
+ Test cases added:
+ * layout-tests/fast/xsl/xslt-text.xml: Added.
+ * layout-tests/fast/xsl/xslt-text.xsl: Added.
+ * layout-tests/fast/xsl/xslt-text-expected.checksum: Added.
+ * layout-tests/fast/xsl/xslt-text-expected.png: Added.
+ * layout-tests/fast/xsl/xslt-text-expected.txt: Added.
+
+ * khtml/xsl/xslt_processorimpl.cpp: (DOM::XSLTProcessorImpl::documentFromXMLDocPtr):
+ Use text rather than CDATA, using entities for & and < so that we can parse no matter what
+ characters are in the text. Also add a head and a title element so the document is well formed.
+
+2005-09-24 Alexey Proskuryakov <ap at nypop.com>
+
+ Reviewed and landed by Darin.
+
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5027
Decoder doesn't auto-detect XML encoded as UTF-16 if BOM is not present
1.10 +8 -8 WebCore/khtml/xsl/xslt_processorimpl.cpp
Index: xslt_processorimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xsl/xslt_processorimpl.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- xslt_processorimpl.cpp 21 Sep 2005 21:05:54 -0000 1.9
+++ xslt_processorimpl.cpp 24 Sep 2005 10:07:08 -0000 1.10
@@ -148,8 +148,6 @@
DocumentImpl *XSLTProcessorImpl::documentFromXMLDocPtr(xmlDocPtr resultDoc, xsltStylesheetPtr sheet)
{
- // FIXME: For now we serialize and then reparse. It might be more optimal to write a DOM converter.
-
if (!resultDoc || !sheet)
return 0;
@@ -166,8 +164,8 @@
return 0;
// There are three types of output we need to be able to deal with:
- // HTML (create an HTML document), XML (create an XML document), and text (wrap in a <pre> and
- // make an XML document).
+ // HTML (create an HTML document), XML (create an XML document),
+ // and text (wrap in a <pre> and create an XML document).
KHTMLView *view = m_sourceDocument->view();
const xmlChar *method;
XSLT_GET_IMPORT_PTR(method, sheet, method);
@@ -185,12 +183,14 @@
if (xmlStrEqual(method, (const xmlChar *)"text")) {
// Modify the output so that it is a well-formed XHTML document with a <pre> tag enclosing the text.
- m_resultOutput = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/strict.dtd\">\n"
+ m_resultOutput.replace('&', "&");
+ m_resultOutput.replace('<', "<");
+ m_resultOutput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
+ "<head><title/></head>\n"
"<body>\n"
- "<pre>\n"
- "<![CDATA[" + m_resultOutput + "]]>\n"
- "</pre>\n"
+ "<pre>" + m_resultOutput + "</pre>\n"
"</body>\n"
"</html>\n";
}
1.1 WebCore/layout-tests/fast/xsl/xslt-text-expected.checksum
Index: xslt-text-expected.checksum
===================================================================
4216e0bf4f23ef9ec935b80316d7fb14
1.1 WebCore/layout-tests/fast/xsl/xslt-text-expected.png
<<Binary file>>
1.1 WebCore/layout-tests/fast/xsl/xslt-text-expected.txt
Index: xslt-text-expected.txt
===================================================================
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
layer at (0,0) size 800x56
RenderBlock {HTML} at (0,0) size 800x56
RenderBody {BODY} at (8,13) size 784x30
RenderBlock {PRE} at (0,0) size 784x30
RenderText {TEXT} at (0,0) size 256x30
text run at (0,0) width 256: "CHARACTERS IN XSLT: <<<&\x{442}\x{435}\x{441}\x{442}&>>>"
text run at (0,15) width 192: "SOURCE XML: <<<&\x{442}\x{435}\x{441}\x{442}&>>>"
1.1 WebCore/layout-tests/fast/xsl/xslt-text.xml
Index: xslt-text.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xslt-text.xsl"?>
<TEST>SOURCE XML: <<<&ÑеÑÑ&>>></TEST>
1.1 WebCore/layout-tests/fast/xsl/xslt-text.xsl
Index: xslt-text.xsl
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="KOI8-R"/>
<xsl:template match="TEST">CHARACTERS IN XSLT: <<<&ÑеÑÑ&>>>
<xsl:apply-templates/><xsl:text> </xsl:text></xsl:template>
<xsl:template >
<xsl:value-of select="." />
</xsl:template>
</xsl:stylesheet>
More information about the webkit-changes
mailing list