;ò lh†>c@sÚdZddd!Zddd!Zddd!ZdkZdklZdkZdk Z dk Z d k l Z d Z d Z d fd „ƒYZdfd„ƒYZdfd„ƒYZdfd„ƒYZdfd„ƒYZdS(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: $iiþÿÿÿs$Date: 2003/03/30 03:45:47 $s$Revision: 1.12 $i N(saq_get(sIXSLTProcessors URNnamespacess XSLparameterssPyanaProcessorcBshtZdZeZdZd„Zd„Zeed„Z d„Z eeed„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.6cCsd|_tt_tt_dS(s+Initialize a new instance of PyanaProcessoriN(sselfs debugLevelsProblemListenersPyanasdefaultProblemListenerFactorys ErrorHandlersdefaultErrorHandlerFactory(sself((sL/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/PyanaProcessor.pys__init__2s  cCs ||_dS(s‹ Set debug level from 0 to 3. 0 = silent 3 = extra verbose Debug messages go to Zope server log. N(slevelsselfs debugLevel(sselfslevel((sL/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/PyanaProcessor.pys setDebugLevelBsc Cs&t}|tj o|i|ƒ}n|idjo dG|GHn|idjodGH|GHdGH|GHnt|ƒtdƒjo|i dƒ}nt|ƒtdƒjo|i dƒ}ny%|i |||||||ƒ} Wn3tj o'}tiit|ƒdƒdSnX| 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. isparams:s xsltContents:s xmlContents:usutf8s sN(sNonestopLevelParamsstransformObjectsselfsgetXSLParameterss debugLevels xsltContentss xmlContentsstypesencodes transformGutssxmlURLsxsltURLsREQUESTsresults Exceptionsessyssstderrswritesstr( sselfs xmlContentssxmlURLs xsltContentssxsltURLstransformObjectsREQUESTsestopLevelParamssresult((sL/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/PyanaProcessor.pys transformMs,    cCsd|||<|SdS(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(svaluesparamMapsname(sselfsparamMapsnamesvalue((sL/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/PyanaProcessor.pysaddParam|sc Cs²h}|tj o|i|ƒ}n|idjo dG|GHn|tjo h}ntiƒ} d| _ | i |ƒ| i t ||ƒƒ| id|d|ƒ} | SdS(sw Actually performs the transformation. Throws an Exception if there are any errors. is namespaces:issourcesstyleN(s namespaceMapstransformObjectsNonesselfsretrieveNamespacess debugLevelsparamssPyanas Transformersts useValidationssetStylesheetParamsssetEntityResolvers URIResolversREQUESTstransform2Strings xmlContentss xsltContentssresult( sselfs xmlContentssxmlURLs xsltContentssxsltURLstransformObjectsparamssREQUESTs namespaceMapstsresult((sL/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/PyanaProcessor.pys transformGuts‡s         cCst|ttƒ}h}|tj oRxO|D]C}t||tƒ}t|ƒo|||