[XML-SIG] 4Suite problems

Uche Ogbuji uche.ogbuji@fourthought.com
Fri, 13 Dec 2002 08:44:39 -0700


> 
> Uhmm.. probably not, but take a look below..
> 
> > > def ProcessFile(input, output):
> >           stylesheet = "/path/to/somesheet.xsl"
> > >         xsltprocessor = Processor()
> > >         xsltprocessor.appendStylesheetUri(stylesheet)
> > >         result = xsltprocessor.runUri(input)
> > >         if result:
> > >                 open(output, "w").write(result)
> > This works for me creating dynamically generating HTML web pages with
> > a Python
> > CGI script, except that I do this with the result:
> > if result:
> >     print "Content-type: text/html\n\n"
> >     print result
> 
> This results in the following error:
> 
>     xsltprocessor.appendStylesheetUri("ujds.xslt")
> AttributeError: Processor instance has no attribute 'appendStylesheetUri'

There is no more 'appendStylesheetUri'.  You replace it with

from Ft.Xml.InputSource import DefaultFactory
xsltprocessor.appendStylesheet(DefaultFactory.fromUri(xsl_uri))
html = xsltproc.run(DefaultFactory.fromUri(src_uri))


> I forgot to mention that I am using 4Suite 0.11.1

You mean 0.12.0, right?


-- 
Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Tour of 4Suite - http://www.xml.com/pub/a/2002/10/16/py-xml.html
Proper XML Output in Python - http://www.xml.com/pub/a/2002/11/13/py-xml.html
RSS for Python - http://www-106.ibm.com/developerworks/webservices/library/ws-pyth11.html
Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-debugxs.html