[XML-SIG] Problem with 4xslt in Python on Windows
Andrew Ittner
andrew.ittner@usa.net
Sun, 14 Jul 2002 22:21:26 -0700
Caution: newbie alert.
I have 'halls.xsl' which has two <xsl:includes>:
<xsl:include href="listofcompanies.xsl"/>
<xsl:include href="tableofcompanies.xsl"/>
All three XSL files, and the Hall.xml they reference, are in the same
directory: D:\Internet\_XML_.
Using 4xslt from the Windows 98 command line generates the HTML output
perfectly.
<4xslt -o..\_SITE_\halloffame.html -DTypeHall=Fame hall.xml halls.xsl>
Running the same files through the following Python script fails:
from Ft.Xml.Xslt import Processor
from Ft.Xml import InputSource
oProcessor = Processor.Processor()
oStyle =
InputSource.DefaultFactory.fromStream(open('D:\Internet\_XML_\halls.xsl',
'r'), 'D:\Internet\_XML_\\')
oProcessor.appendStylesheet(oStyle)
fX = open('D:\X.html', 'w')
sResult =
oProcessor.run(InputSource.DefaultFactory.fromStream(open('D:\Internet\_XML_
\Hall.xml', 'r'), 'D:\Internet\_XML_\\'), 1, None, '', fX)
fX.close()
print "sResult=" + str(len(sResult))
The error I get is:
<snip/>
File "C:\PYTHON22\Lib\site-packages\Ft\Xml\Xslt\StylesheetHandler.py",
line 533, in _combine_stylesheet
raise XsltException(Error.INCLUDE_NOT_FOUND, href,
self._input_source.uri)
XsltException: Unable to open imported or included stylesheet
"listofcompanies.xsl", using base URI "D:\", or all base URIs in the include
PATH
The line in my script causing the error starts with "oStyle=".
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.
Thanks,
Andrew Ittner
http://zip.to/tephyr