[XML-SIG] Problem with 4xslt in Python on Windows

Uche Ogbuji uche.ogbuji@fourthought.com
Mon, 15 Jul 2002 11:05:29 -0600


> [Andrew Ittner]
> 
> > On the line where I make oStyle, I've tried setting the fromStream's 2nd
> > argument, a valid URI, to the following:
> > D:\Internet\_XML_\
> > file://D:/Internet/_XML_/halls.xsl
> > file://localhost/D:/Internet/_XML_/halls.xsl
> > http://tephyr8.home.attbi.com/listofcompanies.xsl
> >
> > Only the last one works (when I post the included XSL files to it).
> >
> > What must I do to make the Python script see the XSL included files on my
> > local drive?  Since the 4xslt command-line works fine with the exact same
> > files in the exact same location, I assume I'm missing something, but I
> > can't figure what.
> >
> 
> Chances are you have to use the correct url syntax for a file:
> 
> (1) file:///d:\Internet\..............
> 
> If that does not work, try this incorrect version:
> 
> (2) file:/d:\Internet\..............
> 
> The double slash version is the one that is least likely to work, because it
> is both incorrect by the RFC and also never came into (incorrect) use.  (1)
> is technically correct according to the RFC,  (2) is not correct but is the
> form that the Python libraries used to support.  I'm not sure but I am
> pretty sure that (1) is now supported.
> 
> If all else fails you could try
> 
> (3) file:///d:/Internet/..............
> 
> The RFC is ambiguous as to whether forward or back-slashes should be used
> when the file system uses backslashes, and some systems are very particular
> about it.  I do not think you need to here, though.

As Mike Brown mentioned, we do have a little utility that does this for you 
now:

from Ft.Lib import Uri
uri = Uri.OsPathToUri(filename, attemptAbsolute=1)

attemptAbsolute tries to make it an absolute URL.  I recommend this.


-- 
Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Track chair, XML/Web Services One Boston: http://www.xmlconference.com/
The many heads of XML modeling - http://adtmag.com/article.asp?id=6393
Will XML live up to its promise? - http://www-106.ibm.com/developerworks/xml/li
brary/x-think11.html