[XML-SIG] xslt/parameters

Matt Price matt.price at utoronto.ca
Sat Aug 14 03:49:20 CEST 2004


Can someone out there tell me how I pass a parameter value to an xsl
stylesheet in python?  Right now I have the following couple lines of
code, more or less stolen from somewhere since I'm still pretty much at
sea with xml:  

    styledoc = libxml2.parseFile(xsl) 
    style = libxslt.parseStylesheetDoc(styledoc) 
    doc = libxml2.parseDoc(risxSet) 
    result = style.applyStylesheet(doc, None) 
    htmlString = style.saveResultToString(result) 

xsl is of course a variable which references a stylesheet.  The
stylesheet has a  parameter setting like this:

<xsl: param name="mainTarget">http://localhost/refdb-client/index.py</xsl:param>

I'd like to pass the parameter to the stylesheet in the above code.
Can this be done in a straightforward way?  I get the impression I
should use the class libxslt.xpathParserContext(), but I really don't
understand how it's supposed to work!  I much appreciate any pointers.
thanks,

matt

-------------------------------------------
Matt Price	    matt.price at utoronto.ca
History Department, University of Toronto
(416) 978-2094
--------------------------------------------


More information about the XML-SIG mailing list