You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Joe Gregorio <jo...@mts.com> on 2000/01/29 04:20:27 UTC

PATCH

Hopefully this is a more palatable patch.


--- process.orig.cpp	Thu Jan 27 22:58:24 2000
+++ process.cpp	Fri Jan 28 22:15:24 2000
@@ -103,6 +103,30 @@
 #include <XSLT/StylesheetExecutionContextDefault.hpp>
 #include <XSLT/XSLTProcessorEnvSupportDefault.hpp>
 
+XMLURL*
+getURLFromString (const DOMString&	urlString, XercesDOMPrintWriter & diag) 
+{
+	std::auto_ptr<XMLURL>	url(new XMLURL);
+	
+	try {
+		url->setURL(c_wstr(urlString));
+		if (XMLURL::Unknown == url->getProtocol()) {
+			DOMString fullpath("file:///");
+
+			XMLCh* lastPart = XMLPlatformUtils::getFullPath(c_wstr(urlString));
+			fullpath += lastPart;
+			url->setURL(c_wstr(fullpath));
+		}
+	}
+
+	catch (const MalformedURLException& e2)
+	{
+			diag.println("Error! Cannot create url for: " + urlString);
+			throw e2;
+	}
+
+	return url.release();
+}
 
 
 /**
@@ -375,7 +399,10 @@
 			
 			if(0 != xslFileName.length())
 			{
-				stylesheet = processor.processStylesheet(xslFileName, theConstructionContext);
+				std::auto_ptr<XMLURL> url(getURLFromString(c_wstr(xslFileName), diagnosticsWriter));
+				assert(url.get() != 0);
+
+				stylesheet = processor.processStylesheet(url->getURLText(), theConstructionContext);
 			}
 
 			if (length(outFileName) != 0)
@@ -393,7 +420,11 @@
 			FormatterListener* formatter = 0;
 
 			assert(inFileName.length());
-			XSLTInputSource theInputSource(c_wstr(inFileName));
+
+			std::auto_ptr<XMLURL> url(getURLFromString(c_wstr(inFileName), diagnosticsWriter));
+			assert(url.get() != 0);
+
+			XSLTInputSource theInputSource(url->getURLText(), 0);
 			DOM_Node sourceTree = processor.getSourceTreeFromInput(&theInputSource);
 
 			/*





-------------------------------------
Joe Gregorio            MTS System Corp
Program Manager         www.mts.com