mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
not part of build; adding XPCOM logging, and whitespace in documents, r=peterv
This commit is contained in:
parent
2026961bdd
commit
2447a9a873
@ -25,18 +25,25 @@
|
||||
* -- added code in ::resolveFunctionCall to support the
|
||||
* document() function.
|
||||
*
|
||||
* $Id: ProcessorState.cpp,v 1.20 2001/03/06 00:12:13 Peter.VanderBeken%pandora.be Exp $
|
||||
* $Id: ProcessorState.cpp,v 1.21 2001/03/07 00:42:56 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of ProcessorState
|
||||
* Much of this code was ported from XSL:P
|
||||
* @version $Revision: 1.20 $ $Date: 2001/03/06 00:12:13 $
|
||||
* @version $Revision: 1.21 $ $Date: 2001/03/07 00:42:56 $
|
||||
**/
|
||||
|
||||
#include "ProcessorState.h"
|
||||
#include "XSLTFunctions.h"
|
||||
#include "URIUtils.h"
|
||||
#ifdef MOZ_XSL
|
||||
#include "nslog.h"
|
||||
#define PRINTF NS_LOG_PRINTF(XPATH)
|
||||
#define FLUSH NS_LOG_FLUSH(XPATH)
|
||||
#else
|
||||
#include "TxLog.h"
|
||||
#endif
|
||||
|
||||
//-------------/
|
||||
//- Constants -/
|
||||
@ -250,10 +257,15 @@ MBool ProcessorState::addToResultTree(Node* node) {
|
||||
break;
|
||||
case Node::TEXT_NODE :
|
||||
//-- if current node is the document, create wrapper element
|
||||
if ( current == resultDocument ) {
|
||||
if ( current == resultDocument &&
|
||||
!XMLUtils::isWhitespace(node->getNodeValue())) {
|
||||
String nodeName(wrapperName);
|
||||
Element* wrapper = resultDocument->createElement(nodeName);
|
||||
resultNodeStack->push(wrapper);
|
||||
while (current->hasChildNodes()){
|
||||
wrapper->appendChild(current->getFirstChild());
|
||||
current->removeChild(current->getFirstChild());
|
||||
}
|
||||
current->appendChild(wrapper);
|
||||
current = wrapper;
|
||||
}
|
||||
@ -428,6 +440,9 @@ Document* ProcessorState::getInclude(const String& href) {
|
||||
} //-- getInclude(String)
|
||||
|
||||
Expr* ProcessorState::getExpr(const String& pattern) {
|
||||
NS_IMPL_LOG(XPATH)
|
||||
PRINTF("Resolving XPath Expr %s",pattern.toCharArray());
|
||||
FLUSH();
|
||||
Expr* expr = (Expr*)exprHash.get(pattern);
|
||||
if ( !expr ) {
|
||||
expr = exprParser.createExpr(pattern);
|
||||
|
@ -38,12 +38,15 @@
|
||||
* Olivier Gerardin
|
||||
* -- Changed behavior of passing parameters to templates
|
||||
*
|
||||
* $Id: XSLTProcessor.cpp,v 1.36 2001/03/06 00:12:09 Peter.VanderBeken%pandora.be Exp $
|
||||
* $Id: XSLTProcessor.cpp,v 1.37 2001/03/07 00:42:57 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
#include "XSLTProcessor.h"
|
||||
#ifdef MOZ_XSL
|
||||
#include "nsIObserverService.h"
|
||||
#include "nslog.h"
|
||||
#else
|
||||
#include "TxLog.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------/
|
||||
@ -53,7 +56,7 @@
|
||||
/**
|
||||
* XSLTProcessor is a class for Processing XSL stylesheets
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.36 $ $Date: 2001/03/06 00:12:09 $
|
||||
* @version $Revision: 1.37 $ $Date: 2001/03/07 00:42:57 $
|
||||
**/
|
||||
|
||||
/**
|
||||
@ -842,9 +845,9 @@ void XSLTProcessor::processAction
|
||||
Node* priorNode = xslAction->getPreviousSibling();
|
||||
Node* nextNode = xslAction->getNextSibling();
|
||||
if (priorNode && (priorNode->getNodeType()==Node::TEXT_NODE))
|
||||
printf("Textnode found in prior in whitespace strip\n");
|
||||
cout << "Textnode found in prior in whitespace strip"<<endl;
|
||||
if (nextNode && (nextNode->getNodeType()==Node::TEXT_NODE))
|
||||
printf("Textnode found in next in whitespace strip\n");
|
||||
cout << "Textnode found in next in whitespace strip"<<endl;
|
||||
#endif
|
||||
if (XMLUtils::shouldStripTextnode(curValue))
|
||||
textValue="";
|
||||
@ -1720,6 +1723,8 @@ void XSLTProcessor::xslCopyOf(ExprResult* exprResult, ProcessorState* ps) {
|
||||
} //-- xslCopyOf
|
||||
|
||||
#ifdef MOZ_XSL
|
||||
#define PRINTF NS_LOG_PRINTF(XSLT)
|
||||
#define FLUSH NS_LOG_FLUSH(XSLT)
|
||||
NS_IMETHODIMP
|
||||
XSLTProcessor::TransformDocument(nsIDOMNode* aSourceDOM,
|
||||
nsIDOMNode* aStyleDOM,
|
||||
@ -1756,7 +1761,9 @@ XSLTProcessor::TransformDocument(nsIDOMNode* aSourceDOM,
|
||||
|
||||
docURL->GetSpec(&urlString);
|
||||
String documentBase(urlString);
|
||||
//cout << "documentbase: " << documentBase << endl;
|
||||
NS_IMPL_LOG(XSLT)
|
||||
PRINTF("Transforming with stylesheet %s",documentBase.toCharArray());
|
||||
FLUSH();
|
||||
ps->setDocumentBase(documentBase);
|
||||
nsCRT::free(urlString);
|
||||
NS_IF_RELEASE(docURL);
|
||||
|
Loading…
Reference in New Issue
Block a user