;ò
lh†>c @ sÚ d Z d d d !Z d d d !Z d d d !Z d k Z d k l Z d k Z d k Z d k
Z
d k l Z d
Z d Z
d f d
„ ƒ YZ d f d „ ƒ YZ d f d „ ƒ YZ d f d „ ƒ YZ d f d „ ƒ YZ d S( s0
$RCSfile: PyanaProcessor.py,v $
This class encapsulates an XSLT Processor for use by ZopeXMLMethods.
This is the Pyana version, including support for XSLT
parameters. It does not yet include support for URN resolution.
Author: Craeg Strong
Release: 1.0
s $Name: $i iþÿÿÿs $Date: 2003/03/30 03:45:47 $s $Revision: 1.12 $i
N( s aq_get( s IXSLTProcessors
URNnamespacess
XSLparameterss PyanaProcessorc B sh t Z d Z e Z d Z d „ Z d „ Z e e d „ Z d „ Z
e e e d „ Z d „ Z d „ Z
RS( sÒ
This class encapsulates an XSLT Processor for use by
ZopeXMLMethods. This is the Pyana version, including support for
XSLT parameters. It does not yet include support for URN
resolution.
s Pyana 0.6c C s d | _ t t _ t t _ d S( s+ Initialize a new instance of PyanaProcessori N( s selfs
debugLevels ProblemListeners Pyanas defaultProblemListenerFactorys ErrorHandlers defaultErrorHandlerFactory( s self( ( sL /mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/PyanaProcessor.pys __init__2 s c C s
| | _ d S( s‹
Set debug level from 0 to 3.
0 = silent
3 = extra verbose
Debug messages go to Zope server log.
N( s levels selfs
debugLevel( s selfs level( ( sL /mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/PyanaProcessor.pys
setDebugLevelB s c
C s& t } | t j o | i | ƒ } n | i d j o
d G| GHn | i d j o d GH| GHd GH| GHn t | ƒ t d ƒ j o | i d ƒ } n t | ƒ t d ƒ j o | i d ƒ } n y% | i
| | | | | | | ƒ } Wn3 t j
o' } t i i t | ƒ d ƒ d Sn X| Sd S(
sE
Transforms the passed in XML into the required output (usually
HTML) using the passed in XSLT. Both the XML and XSLT strings
should be well-formed. Returns the output as a string.
transformObject and REQUEST params may be used to acquire Zope
content such as XSLT parameters and URN namespaces, if
required. Catches any exceptions thrown by transformGuts and
sends the error output to stderr, returns empty string to the
caller. The idea is that web site users will at worst see an
empty page.
i s params:s
xsltContents:s xmlContents:u s utf8s
s N( s Nones topLevelParamss transformObjects selfs getXSLParameterss
debugLevels xsltContentss xmlContentss types encodes
transformGutss xmlURLs xsltURLs REQUESTs results Exceptions es syss stderrs writes str(
s selfs xmlContentss xmlURLs xsltContentss xsltURLs transformObjects REQUESTs es topLevelParamss result( ( sL /mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/PyanaProcessor.pys transformM s,
c C s d | | | <| Sd S( sÃ
This is a convenience function for adding parameters in the
correct format to the parameter map to be used for the
'params' parameter in transformGuts.
s '%s'N( s values paramMaps name( s selfs paramMaps names value( ( sL /mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/PyanaProcessor.pys addParam| s c C s² h } | t j o | i | ƒ } n | i d j o
d G| GHn | t j o
h } n t i ƒ } d | _
| i | ƒ | i t
| | ƒ ƒ | i d | d | ƒ }
|
Sd S( sw
Actually performs the transformation. Throws an Exception if
there are any errors.
i s namespaces:i s sources styleN( s namespaceMaps transformObjects Nones selfs retrieveNamespacess
debugLevels paramss Pyanas Transformers ts
useValidations setStylesheetParamss setEntityResolvers URIResolvers REQUESTs transform2Strings xmlContentss xsltContentss result( s selfs xmlContentss xmlURLs xsltContentss xsltURLs transformObjects paramss REQUESTs namespaceMaps ts result( ( sL /mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/PyanaProcessor.pys
transformGuts‡ s
c C s t | t t ƒ } h } | t j oR xO | D]C } t | | t ƒ } t | ƒ o | | |