[XML-SIG] XML from scratch and transformation with XSLT

Marc Garcia mgarcia at accopensys.com
Sun Apr 2 01:11:37 CEST 2006


Thanks for your opinion Peter, it have been useful to me.

I'm used to do transformations directly when I get data from database, 
but I think that this new way make applications easier to maintain, the 
code is logically divided, and the this is more clear.

The ElementTree is good, and for me the best would be use the lxml 
implementation so it have xslt support, but it isn't a rpm package and 
is difficult for me install it in my fedora server without development 
environment.

Finally I did it with libxml2/libxslt, after solving some encoding 
problems. Probably I'll develop my own class, to abstract it, and to 
make it easy if in the future I want to change this library.

Thanks,
  Marc

Peter Herndon wrote:

> On Mar 31, 2006, at 2:46 PM, Marc Garcia wrote:
>
>> I want to make a simple program in python that get data from a  database
>> (or other source), create a new xml document with it and then parse it
>> with an existing xslt sheet.
>>
>
> Why would you do this?  That is, you are pulling data from a database  
> into Python, then transforming it into XML, then running that XML  
> through an XSLT transformation.  Why not pull the data into Python,  
> manipulate them in Python, then output as the end-result XML?  That  
> is, transcribe from Python directly to the desired final XML format?
>
> I can think of a couple of reasons to do it your way -- the XSLT  
> engine might well be faster than the Python transformation, it might  
> be easier to output simple XML and then expand it via XSLT, etc. --  
> but I'm wondering if you've considered the above simpler path?  It  
> might make your life easier.
>
>> Do somebody know what is the simplest way to achieve it? I'm having  
>> some
>> problems with all of it (encoding problems, installation bugs, more  
>> than
>> one library required...) and I need some expert tips to know what  way I
>> have to work on.
>>
>
> I'm hardly an expert, and your email doesn't present enough data to  
> make any specific recommendations, but I'd suggest using (c) 
> ElementTree as your XML library, if it meets your requirements.  You  
> could pull the data in, do your manipulations in Python, then create  
> your XML using ElementTree.  And it will solve your installation  
> issues if you can afford to wait long enough -- it will be in the  
> standard library for Python 2.5.  Otherwise, ElementTree itself is  
> pure Python, and is thus easily installed, though there is an  
> optional C extension (cElementTree) that will improve performance.
>
> ---Peter
>


More information about the XML-SIG mailing list