diff --git a/extensions/transformiix/source/xslt/ProcessorState.cpp b/extensions/transformiix/source/xslt/ProcessorState.cpp
index 9dc5033a2c3e..445305f33387 100644
--- a/extensions/transformiix/source/xslt/ProcessorState.cpp
+++ b/extensions/transformiix/source/xslt/ProcessorState.cpp
@@ -25,13 +25,13 @@
* -- added code in ::resolveFunctionCall to support the
* document() function.
*
- * $Id: ProcessorState.cpp,v 1.24 2001/04/11 15:01:05 axel%pike.org Exp $
+ * $Id: ProcessorState.cpp,v 1.25 2001/04/12 14:04:49 peterv%netscape.com Exp $
*/
/**
* Implementation of ProcessorState
* Much of this code was ported from XSL:P
- * @version $Revision: 1.24 $ $Date: 2001/04/11 15:01:05 $
+ * @version $Revision: 1.25 $ $Date: 2001/04/12 14:04:49 $
**/
#include "ProcessorState.h"
@@ -399,40 +399,6 @@ Stack* ProcessorState::getDefaultNSURIStack() {
return &defaultNameSpaceURIStack;
} //-- getDefaultNSURIStack
-/**
- * Returns the global document base for resolving relative URIs within
- * the XSL stylesheets
-**/
-const String& ProcessorState::getDocumentBase() {
- return documentBase;
-} //-- getDocumentBase
-
-/**
- * Returns the href for the given XSL document by looking in the
- * includes and imports lists
- **/
-void ProcessorState::getDocumentHref
- (Document* xslDocument, String& documentBase)
-{
-
- documentBase.clear();
-
- //-- lookup includes
- StringList* keys = includes.keys();
- StringListIterator* iter = keys->iterator();
- while (iter->hasNext()) {
- String* key = iter->next();
- TxObjectWrapper* objWrapper
- = (TxObjectWrapper*)includes.get(*key);
- if (xslDocument == objWrapper->object) {
- documentBase.append(*key);
- break;
- }
- }
- delete iter;
- delete keys;
-} //-- getDocumentBase
-
/**
* @return the included xsl document that was associated with the
* given href, or null if no document is found
@@ -674,10 +640,6 @@ void ProcessorState::setDefaultNameSpaceURIForResult(const String& nsURI) {
/**
* Sets the document base for use when resolving relative URIs
**/
-void ProcessorState::setDocumentBase(const String& documentBase) {
- this->documentBase = documentBase;
-} //-- setDocumentBase
-
/**
* Sets the output method. Valid output method options are,
* "xml", "html", or "text".
diff --git a/extensions/transformiix/source/xslt/ProcessorState.h b/extensions/transformiix/source/xslt/ProcessorState.h
index e3db9666d41a..a6b42860fa5a 100644
--- a/extensions/transformiix/source/xslt/ProcessorState.h
+++ b/extensions/transformiix/source/xslt/ProcessorState.h
@@ -21,7 +21,7 @@
* Keith Visco, kvisco@ziplink.net
* -- original author.
*
- * $Id: ProcessorState.h,v 1.12 2001/04/08 14:33:28 peterv%netscape.com Exp $
+ * $Id: ProcessorState.h,v 1.13 2001/04/12 14:04:52 peterv%netscape.com Exp $
*/
@@ -43,7 +43,7 @@
/**
* Class used for keeping the current state of the XSL Processor
* @author Keith Visco
- * @version $Revision: 1.12 $ $Date: 2001/04/08 14:33:28 $
+ * @version $Revision: 1.13 $ $Date: 2001/04/12 14:04:52 $
**/
class ProcessorState : public ContextState {
@@ -127,17 +127,6 @@ public:
**/
Stack* getDefaultNSURIStack();
- /**
- * Returns the document base for resolving relative URIs
- **/
- const String& getDocumentBase();
-
- /**
- * Returns the href for the given xsl document by returning
- * it's reference from the include or import list
- **/
- void getDocumentHref(Document* xslDocument, String& documentBase);
-
/**
* @return the included xsl document that was associated with the
* given href, or null if no document is found
@@ -242,11 +231,6 @@ public:
**/
void setDefaultNameSpaceURIForResult(const String& nsURI);
- /**
- * Sets the document base for including and importing stylesheets
- **/
- void setDocumentBase(const String& documentBase);
-
/**
* Sets the output method. Valid output method options are,
* "xml", "html", or "text".
@@ -435,8 +419,6 @@ private:
Element* dfWildCardTemplate;
Element* dfTextTemplate;
- String documentBase;
-
/**
* Returns the closest xml:space value for the given node
**/
diff --git a/extensions/transformiix/source/xslt/XSLTProcessor.cpp b/extensions/transformiix/source/xslt/XSLTProcessor.cpp
index 0fdea9019d44..eccfbd43506f 100644
--- a/extensions/transformiix/source/xslt/XSLTProcessor.cpp
+++ b/extensions/transformiix/source/xslt/XSLTProcessor.cpp
@@ -38,7 +38,7 @@
* Olivier Gerardin
* -- Changed behavior of passing parameters to templates
*
- * $Id: XSLTProcessor.cpp,v 1.41 2001/04/12 10:13:59 peterv%netscape.com Exp $
+ * $Id: XSLTProcessor.cpp,v 1.42 2001/04/12 14:04:45 peterv%netscape.com Exp $
*/
#include "XSLTProcessor.h"
@@ -68,7 +68,7 @@
/**
* XSLTProcessor is a class for Processing XSL stylesheets
* @author Keith Visco
- * @version $Revision: 1.41 $ $Date: 2001/04/12 10:13:59 $
+ * @version $Revision: 1.42 $ $Date: 2001/04/12 14:04:45 $
**/
/**
@@ -428,21 +428,19 @@ void XSLTProcessor::processTopLevel
//-- Read in XSL document
if (ps->getInclude(href)) {
+ /* XXX this is wrong, it's allowed to include one stylesheet multiple
+ times but we should build some sort of stack to make sure that we
+ don't have circular inclusions */
String err("stylesheet already included: ");
err.append(href);
notifyError(err, ErrorObserver::WARNING);
break;
}
- //-- get document base
- String realHref;
- String thisDocBase = ps->getDocumentBase();
String errMsg;
XMLParser xmlParser;
- URIUtils::resolveHref(href, thisDocBase, realHref);
-
- Document* xslDoc = xmlParser.getDocumentFromURI(realHref, thisDocBase, errMsg);
+ Document* xslDoc = xmlParser.getDocumentFromURI(href, element->getBaseURI(), errMsg);
if (!xslDoc) {
String err("error including XSL stylesheet: ");
@@ -454,11 +452,7 @@ void XSLTProcessor::processTopLevel
else {
//-- add stylesheet to list of includes
ps->addInclude(href, xslDoc);
- String newDocBase;
- URIUtils::getDocumentBase(realHref, newDocBase);
- ps->setDocumentBase(newDocBase);
processTopLevel(xslDoc, ps);
- ps->setDocumentBase(thisDocBase);
}
break;
@@ -552,7 +546,6 @@ Document* XSLTProcessor::process
//-- create a new ProcessorState
ProcessorState ps(xslDocument, *result);
- ps.setDocumentBase(xslDocument.getBaseURI());
//-- add error observers
ListIterator* iter = errorObservers.iterator();
@@ -591,7 +584,6 @@ void XSLTProcessor::process
//-- create a new ProcessorState
ProcessorState ps(xslDocument, *result);
- ps.setDocumentBase(xslDocument.getBaseURI());
//-- add error observers
ListIterator* iter = errorObservers.iterator();
@@ -1754,25 +1746,6 @@ XSLTProcessor::TransformDocument(nsIDOMNode* aSourceDOM,
//-- create a new ProcessorState
ProcessorState* ps = new ProcessorState(*xslDocument, *resultDocument);
- // XXX HACK, baseURI is something to be done in the DOM
- nsIURI* docURL = nsnull;
- nsCOMPtr sourceNsDocument = do_QueryInterface(styleDOMDocument);
- sourceNsDocument->GetBaseURL(docURL);
- if (docURL) {
- char* urlString;
-
- docURL->GetSpec(&urlString);
- String documentBase(urlString);
-// NS_IMPL_LOG(XSLT)
-// PRINTF("Transforming with stylesheet %s",documentBase.toCharArray());
-// FLUSH();
- ps->setDocumentBase(documentBase);
- nsCRT::free(urlString);
- NS_IF_RELEASE(docURL);
- }
- else
- ps->setDocumentBase("");
-
//-- add error observers
//------------------------------------------------------/