libxslt, libxml and xmldoc problem

Aseem Mohanty aseem at neurobehavioralsystems.com
Wed Aug 21 08:27:05 CEST 2002


I read about Pyana on the Zope list, my only concern is, (since you are 
the author, you would/should know) is Pyana stable enough for a 
production server  with 1000s of XML files and ~50 XSLT translations per 
couple of seconds?

Thanks
AM

Brian Quinlan wrote:

>>import libxml2
>>import libxslt
>>
>>styledoc = libxml2.parseFile("help_page.xsl")
>>style = libxslt.parseStylesheetDoc(styledoc)
>>doc = libxml2.parseFile("A_First_Scenario.xml")
>>result = style.applyStylesheet(doc, None)
>>style.saveResultToFilename("-", result, 0)
>>style.freeStylesheet()
>>doc.freeDoc()
>>result.freeDoc()
>>
>
>If you can switch libraries, I might suggest using Pyana
>(http://pyana.sourceforge.net). You could rewrite that entire code block
>as:
>
>import Pyana
>
>result = Pyana.transform2String(Pyana.URI("A_First_Scenario.xml"),
>                                Pyana.URI("help_page.xsl"))
>
>
>If you were writing it for Apache and CGI, there would be no reason to
>save the result as a string, so you could write it like:
>
>import Pyana
>import sys
>
>result = Pyana.transform2Writer(Pyana.URI("A_First_Scenario.xml"),
>                                Pyana.URI("help_page.xsl"),
>					  sys.stdout)
>
>Note:
>1. I'm the author of Pyana so I'm hardly objective
>2. If you are using Linux, you will have to build Pyana yourself
>
>Cheers,
>Brian
>
>
>

-- 
==================================================================
 Aseem Mohanty							   
 Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 
 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231		  	
==================================================================								  	
 "I saw `cout' being shifted "Hello world" times to the left and  
  stopped right there!!"                        -- Steve Gonedes  
================================================================== 







More information about the Python-list mailing list