[XML-SIG] XSLT parameters

Uche Ogbuji uche.ogbuji@fourthought.com
Mon, 09 Dec 2002 08:31:39 -0700


Ouch.  Seems I misconfigured procmail so I hid XML-SIG messages since mid 
November.  I *thought* this list was rather quiet  :-)

> Hi:
> 
> I'm using xml.xslt.Processor in a CGI script to transform XML to HTML using 
> XSL. Simple enough, and works great.
> 
> But what is the syntax/method to pass parameters to the XSL stylesheet?
> 
> I tried something like this but it doesn't work:
> 
> html = xsltproc.runUri(xmlfile, topLevelParams={'p': 27})
> 
> This topic seems to be almost completely undocumented in PyXML, 4Suite and 
> Python documentation.
> 
> Any pointers greatly appreciated. TIA.

http://uche.ogbuji.net/tech/akara/pyxml/python-xslt/
http://www.xml.com/pub/a/2002/10/16/py-xml.html
http://uche.ogbuji.net/tech/akara/pyxml/
http://uche.ogbuji.net/tech/akara/4suite/

In particular, xml.xslt in recent PyXML releases is broken.  Download 4Suite 
and use Ft.Xml.Xslt and make other adjustments.

e.g. from the Python & XML book:


from xml.xslt.Processor import Processor

xsltproc = Processor()

xsltproc.appendStylesheetUri("story.xsl")
html = xsltproc.runUri("story.xml")

  
becomes:


from Ft.Xml.Xslt.Processor import Processor
from Ft.Xml.InputSource import DefaultFactory

xsltproc = Processor()

xsltproc.appendStylesheet(DefaultFactory.fromUri("story.xsl"))
html = xsltproc.run(DefaultFactory.fromUri("story.xml"))


Good luck.  

-- 
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-p
yth11.html
Debug XSLT on the fly - http://www-106.ibm.com/developerworks/xml/library/x-deb
ugxs.html