Polish the XML error message so that it indicates when a document is the result...
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Aug 2004 20:38:54 +0000 (20:38 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Aug 2004 20:38:54 +0000 (20:38 +0000)
when reporting line/col #s.

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::applyXSLTransform):
        * khtml/xml/xml_tokenizer.cpp:
        (khtml::XMLTokenizer::insertErrorMessageBlock):
        * khtml/xsl/xslt_processorimpl.cpp:
        (DOM::XSLTProcessorImpl::documentFromXMLDocPtr):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7340 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/xml/dom_docimpl.cpp
WebCore/khtml/xml/xml_tokenizer.cpp
WebCore/khtml/xsl/xslt_processorimpl.cpp

index f8e5b5bcb887163ebcbd7697af681b3ee38b534a..74a24e8db6e28e4e4511b2f6dc39f11f2eb940c7 100644 (file)
@@ -1,3 +1,15 @@
+2004-08-24  David Hyatt  <hyatt@apple.com>
+
+       Polish the XML error message so that it indicates when a document is the result of an XSL transformation
+       when reporting line/col #s.
+       
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::applyXSLTransform):
+        * khtml/xml/xml_tokenizer.cpp:
+        (khtml::XMLTokenizer::insertErrorMessageBlock):
+        * khtml/xsl/xslt_processorimpl.cpp:
+        (DOM::XSLTProcessorImpl::documentFromXMLDocPtr):
+
 2004-08-24  David Hyatt  <hyatt@apple.com>
 
        Add support for Atom and RSS MIME types to the set of XML types.
index f9b762123635ee9a77a5f187bb4c6b944a75523b..beb0cc5cb636066246c3e72e8749be945c1078d2 100644 (file)
@@ -3078,10 +3078,7 @@ void DocumentImpl::applyXSLTransform(ProcessingInstructionImpl* pi)
 {
     // Ref ourselves to keep from being destroyed.
     XSLTProcessorImpl processor(static_cast<XSLStyleSheetImpl*>(pi->sheet()), this);
-    DocumentImpl* result = processor.transformDocument(this);
-    if (result)
-        // Cache the source document.
-        result->setTransformSourceDocument(this);
+    processor.transformDocument(this);
 
     // FIXME: If the transform failed we should probably report an error (like Mozilla does) in this
     // case.
index e87a4600bdbde0c5001295e6e3ec49f269a37323..b69fcebf73e6ca4210ea84d6dcf69278693c3523 100644 (file)
@@ -621,13 +621,18 @@ void XMLTokenizer::insertErrorMessageBlock()
     fixed->appendChild(textNode, exceptioncode);
     reportDiv->appendChild(fixed, exceptioncode);
     h3 = doc->createElementNS(XHTML_NAMESPACE, "h3", exceptioncode);
-    h3->appendChild(doc->createTextNode("Below is a rendering of the page up to the first error."), exceptioncode);
     reportDiv->appendChild(h3, exceptioncode);
     
+    h3->appendChild(doc->createTextNode("Below is a rendering of the page up to the first error."), exceptioncode);
+    if (doc->transformSourceDocument()) {
+        ElementImpl* par = doc->createElementNS(XHTML_NAMESPACE, "p", exceptioncode);
+        reportDiv->appendChild(par, exceptioncode);
+        par->setAttribute(ATTR_STYLE, "white-space: normal");
+        par->appendChild(doc->createTextNode("This document was created as the result of an XSL transformation. The line and column numbers given are from the transformed result."), exceptioncode);
+    }
     root->insertBefore(reportDiv, root->firstChild(), exceptioncode);
 
-    m_doc->document()->recalcStyle( NodeImpl::Inherit );
-    m_doc->document()->updateRendering();
+    doc->updateRendering();
 }
 
 void XMLTokenizer::addScripts(NodeImpl *n)
index 089af763a8ec08b5a9fc853a594f342b9964b99d..c540671d99d967318f0af7bfe521fef2ce57116c 100644 (file)
@@ -144,7 +144,8 @@ DocumentImpl* XSLTProcessorImpl::documentFromXMLDocPtr(xmlDocPtr resultDoc, xslt
         result->setBaseURL(m_sourceDocument->baseURL());
         result->setDecoder(m_sourceDocument->decoder()); // FIXME: Should just be UTF-16.
         result->docLoader()->setShowAnimations(m_sourceDocument->docLoader()->showAnimations());
-        
+        result->setTransformSourceDocument(m_sourceDocument);
+
         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.