;ò bl‡>c@sYdZddd!Zddd!Zddd!ZdklZdkZdkZdk Z dk Z dk Z d k l Z lZeiid ƒ od eid Craeg Strong Release: 1.0 s $Name: $iiþÿÿÿs$Date: 2003/03/30 22:14:57 $s$Revision: 1.5 $i (sStringION(saq_getsaq_chains XML_CATALOGSs/please/ignore/this/workaround(s InputSourcesInputSourceFactory(sXPath(s UriException(sSchemeRegistryResolver(s Processors XsltException(sCatalogsCatalogInputSource(sIXSLTProcessors URNnamespacess XSLparameterss XMLcatalogsFourSuiteProcessorcBsqtZdZeZdZd„Zd„Zeed„Z d„Z eeed„Z d„Z d„Z d „ZRS( s» This class encapsulates an XSLT Processor for use by ZopeXMLMethods. This is the 4Suite 1.0 alpha version, including support for XSLT parameters and URL/URN resolution. s4Suite 1.0alphacCs d|_dS(s/Initialize a new instance of FourSuiteProcessoriN(sselfs debugLevel(sself((sP/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/FourSuiteProcessor.pys__init__GscCs ||_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((sP/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/FourSuiteProcessor.pys setDebugLevelOsc Cs:t}|tj o|i|ƒ}n|idjo dG|GHn|idjo,dGH|GHdGH|GHdGH|GHdGH|GHnt |ƒt dƒjo|i dƒ}nt |ƒt dƒjo|i dƒ}ny%|i |||||||ƒ} Wn3tj o'}tiit|ƒd ƒd SnX| 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:sxsltURLs xmlContents:sxmlURLusutf8s sN(sNonestopLevelParamsstransformObjectsselfsgetXSLParameterss debugLevels xsltContentssxsltURLs xmlContentssxmlURLstypesencodes transformGutssREQUESTsresults Exceptionsessyssstderrswritesstr( sselfs xmlContentssxmlURLs xsltContentssxsltURLstransformObjectsREQUESTsestopLevelParamssresult((sP/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/FourSuiteProcessor.pys transformZs4    cCs||t|f<|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. N(svaluesparamMapsNonesname(sselfsparamMapsnamesvalue((sP/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/FourSuiteProcessor.pysaddParam‹scCsˆt} |tj o|i|ƒ} n|idjo&| tjo dGHq\dG| iGHnh}|tj o|i|ƒ}n|idjo dG|GHn|idjoCdk l }|i ƒ}|idjod|_ d|_qþn tiƒ}yít||ƒ} td| ƒ|_| tjo:tt|ƒ|d| ƒ}tt|ƒ|d| ƒ} n=t| t|ƒ|d| ƒ}t| t|ƒ|d| ƒ} |i| ƒ|i|d|ƒ} |idjod GH| GHd GHnWn’t"j o}t$t%|ƒƒ‚nmt&i't&i(fj oT}t)|d ƒo)d |i*t%|ƒf} t$| ƒ‚q€t$t%|ƒƒ‚nX| Sd S(sw Actually performs the transformation. Throws an Exception if there are any errors. isno XML catalog registeredscatalog:s namespaces:(sExtendedProcessingElementsisresolverstopLevelParamss ===Result===s ============s stylesheetUrisWhile processing %s %sN(,sNonescatalogstransformObjectsselfs getXMLCatalogs debugLevelsuris namespaceMapsretrieveNamespacess Ft.Xml.XsltsExtendedProcessingElementssExtendedProcessors processors _4xslt_debugs _4xslt_traces Processors URNResolversREQUESTs myResolversInputSourceFactorysinputSourceFactorys InputSourcesStringIOs xmlContentssxmlURLsdocSrcs xsltContentssxsltURLsstyleSrcsCatalogInputSourcesappendStylesheetsrunsparamssresults XsltExceptionses ExceptionsstrsXPathsRuntimeExceptionsCompiletimeExceptionshasattrs stylesheetUrismessage(sselfs xmlContentssxmlURLs xsltContentssxsltURLstransformObjectsparamssREQUESTsExtendedProcessingElementssresultsmessagesstyleSrcs myResolverscatalogses namespaceMapsdocSrcs processor((sP/mnt/gmirror/ports/www/zope-xmlmethods/work/ZopeXMLMethods/FourSuiteProcessor.pys transformGuts–s`                 cCst|ttƒ}h}|tj oRxO|D]C}t||tƒ}t|ƒo|||