;ņ
lh>c @ s d Z d d d !Z d d d !Z d d d !Z d k l Z d k l Z d k l Z d
k
l Z d k l
Z
d k l 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 e e f d YZ d e
e f d YZ d S( s
$RCSfile: FourSuite11Processor.py,v $
This class encapsulates an XSLT Processor for use by ZopeXMLMethods.
This is the 4Suite 0.11 version, including support for XSLT parameters
and URL/URN resolution.
Author: Craeg Strong
Release: 1.0
s $Name: $i iž’’’s $Date: 2003/03/30 03:45:47 $s $Revision: 1.27 $i
( s xpath( s Processor( s
XsltException( s StylesheetReader( s
PyExpatReader( s aq_get( s StringION( s IXSLTProcessors
URNnamespacess
XSLparameterss FourSuite11Processorc 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 4Suite 0.11 version, including support
for XSLT parameters and URN resolution.
s
4Suite-0.11.1c C s
d | _ d S( s1 Initialize a new instance of FourSuite11Processori N( s selfs
debugLevel( s self( ( sR /mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/FourSuite11Processor.pys __init__6 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( ( sR /mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/FourSuite11Processor.pys
setDebugLevel> 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 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:s
s N( s Nones topLevelParamss transformObjects selfs getXSLParameterss
debugLevels xsltContentss xmlContentss
transformGutss xmlURLs xsltURLs REQUESTs results Exceptions es syss stderrs writes str(
s selfs xmlContentss xmlURLs xsltContentss xsltURLs transformObjects REQUESTs es topLevelParamss result( ( sR /mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/FourSuite11Processor.pys transformI s$
c C s | | d | f <| 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 N( s values paramMaps name( s selfs paramMaps names value( ( sR /mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/FourSuite11Processor.pys addParamn s c C sĘ h }
| t j o | i | }
n | i d j o
d G|
GHn | i d j oI d k l } l }
| i } | i d j o d | _ d | _ q„ n
t
} y | i t |
| | g | i t |
| | i | | | i | d | d | } | i d j o d GH| GHd GHn Wn t j
o } t t | nm t i t i f j
oT } t! | d o) d
| i" t | f } t | q¾t t | n X| Sd S( sw
Actually performs the transformation. Throws an Exception if
there are any errors.
i s namespaces:( s ExtendedProcessingElementss StylesheetReaderi s topLevelParamss baseUris ===Result===s ============s
stylesheetUris While processing %s
%sN($ s namespaceMaps transformObjects Nones selfs retrieveNamespacess
debugLevels xml.xslts ExtendedProcessingElementss StylesheetReaders ExtendedProcessors processors _4xslt_debugs _4xslt_traces Processors setStylesheetReaders StylesheetURIResolvers REQUESTs xsltURLs setDocumentReaders DocumentURIResolvers appendStylesheetStrings xsltContentss runStrings xmlContentss paramss results
XsltExceptions es Exceptions strs xpaths RuntimeExceptions CompiletimeExceptions hasattrs
stylesheetUris message( s selfs xmlContentss xmlURLs xsltContentss xsltURLs transformObjects paramss REQUESTs ExtendedProcessingElementss results StylesheetReaders messages es namespaceMaps processor( ( sR /mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/FourSuite11Processor.pys
transformGutsy s@
c C s t | t t } h } | t j oR xO | D]C } t | | t } t | o | | |