2.1 a small example

The following example, included with Sab-pyth, uses the low level functions exported by the Sablot module to python, to process an XML file input.xml with an XSL style sheet sheet.xsl.

# read the input files:
sheet = open('sheet.xsl', 'r').read()
input = open('input.xml', 'r').read()

import Sablot

# create a processor object:
sp = Sablot.CreateProcessor()

# call the run() method:
sp.run('arg:sheet', 'arg:input', 'arg:output', [], [('input', input),
('sheet', sheet)])

# print the output, assuming it is encoded in utf-8 (the default
# encoding output by Sablotron):
text = unicode(sp.getResultArg('output'), 'utf8')
print text.encode('ISO-8859-1')

Send comments to guenter@ubka.uni-karlsruhe.de.