[XML-SIG] Pyana (a Python interface to the Xalan XSLT engine) 0.1.0 released

Brian Quinlan brian@sweetapp.com
Sat, 7 Jul 2001 12:27:13 -0700


Windows binaries (you can get the source from CVS) for Pyana 0.1.0 have
been released and are available at:

http://sourceforge.net/project/showfiles.php?group_id=28142

It fixes a log of bugs and introduces the experimental ability to extend
the Xalan XPath engine with Python functions.

Here is a simple example:

def sum(*args):
    """Compute the sum of all arguments"""
    s = 0
    for i in args:
        s += i
    return s

Pyana.install( 'exampleNS', sum, 'sum' )

inputExampleXSL = r'''
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:py="exampleNS" version="1.0">
    <xsl:output method="text"/>
    <xsl:template match="message"><xsl:value-of
select="py:sum(1,2,3,4,5)"/></xsl:template>
</xsl:stylesheet>
'''

inputExampleXML = r'''
<message>ignored</message>
'''

print Pyana.transform(inputExampleXML, inputExampleXSL) # => '15'