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

Andrew Ittner andrew.ittner@usa.net
Mon, 15 Jul 2002 21:43:16 -0700


> > Chances are you have to use the correct url syntax for a file:
> >
> > (1) file:///d:\Internet\..............
> >
	That works!  Thank you.  (Jeez, just one extra slash was all I needed???)
>
> 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)

	I don't have OsPathToUri, as I just realized that the 0.12.0a2 version I
use doesn't have the latest and greatest fixes.  Guess I get to learn how to
use CVS (told you I was new at this!).

Now, for the follow-up: I have a single parameter in my XSL file, so I can
make two outputs from the same XML/XSL combo.  Again, the 4xslt command-line
processor runs it perfectly, but the Python script barfs.

_Start of the XSL file:_
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
	version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:fo="http://www.w3.org/1999/XSL/Format"
	xmlns:date="http://exslt.org/dates-and-times"
	xmlns:user="urn:zip.to-tephyr"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	exclude-result-prefixes="fo user xsi">
<xsl:include href="listofcompanies.xsl"/>
<xsl:include href="tableofcompanies.xsl"/>
<xsl:output method = "html"
	encoding="UTF-8"
	doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>

<xsl:param name="xsl:TypeHall">Fame</xsl:param>

_Parameter declaration inside the Python script:_
prmX = {}
prmX[('http://www.w3.org/1999/XSL/Transform', 'TypeHall')] = 'Shame'

_Script line that's causing problems:_
sResult = oProcessor.run(InputSource.DefaultFactory.fromStream(fXML, oURI),
1, prmX, '', fHTML)

(fXML & fHTML are open files; oURI is the valid URI.)

_And finally, the last lines of the error:_
  File "C:\PYTHON22\Lib\site-packages\Ft\Xml\Xslt\Stylesheet.py", line 325,
in _computeGlobalVar
    vnode = self._topVariables[0][vname]
KeyError: (None, u'TypeHall')

So, what am I missing? Is it as simple as a single backslash... ;-)

Thanks,

Andrew Ittner
http://zip.to/tephyr