🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.text.xml
Article #86

Re: Transfo XSLT et python

#86
From: jb
Date: Fri, 14 Nov 2003 00:46
43 lines
2112 bytes
Tu peux utiliser la libxml
http://xmlsoft.org/XSLT/python.html

un bout de script en provenance du site ressemble fort � ton bout de code
:))

import libxml2
import libxslt

styledoc = libxml2.parseFile("test.xsl")
style = libxslt.parseStylesheetDoc(styledoc)
doc = libxml2.parseFile("test.xml")
result = style.applyStylesheet(doc, None)
style.saveResultToFilename("foo", result, 0)
style.freeStylesheet()
doc.freeDoc()
result.freeDoc()

salut

JB



"Olivier Hoarau" <olivier.hoarau@mortauxspams.bz> a �crit dans le message de
news:3FB3AF66.2023FE99@mortauxspams.bz...
> Resalut,
>
> Je cherche � g�n�rer un fichier � partir d'un fichier xml gr�ce � une
> transfo XSLT, le tout en python.
> Quelqu'un aurait-il des exemples (simples) pour faire cela ? Du style
>
> import libxslt
> import libxml2
>
> xsl=parseStylesheetFile(le fichier xsl)
> xml=parseFile(le fichier doc)
> result = applyStylesheet(xls,xml)
> saveResultToFilename(result,fichierout)
>
>
> Olivier
Technical Details
Message-ID: <3fb425ec$0$10419$626a54ce@news.free.fr>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!feeder2-1.proxad.net!news1-1.free.fr!not-for-mail
References: <3FB3AF66.2023FE99@mortauxspams.bz>

Show Full Headers
Complete Article Headers
X-Google-Language: FRENCH,ASCII
X-Google-Thread: 114f60,3437d0752384d0ce
X-Google-Attributes: gid114f60,public
X-Google-Thread: 10dbd3,3437d0752384d0ce
X-Google-Attributes: gid10dbd3,public
X-Google-ArrivalTime: 2003-11-13 16:46:37 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!feeder2-1.proxad.net!news1-1.free.fr!not-for-mail
From: "jb" <zorro@chez.com>
Newsgroups: fr.comp.text.xml,fr.comp.lang.python
References: <3FB3AF66.2023FE99@mortauxspams.bz>
Subject: Re: Transfo XSLT et python
Date: Fri, 14 Nov 2003 01:46:37 +0100
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Lines: 45
Message-ID: <3fb425ec$0$10419$626a54ce@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 14 Nov 2003 01:46:36 MET
NNTP-Posting-Host: 81.57.107.149
X-Trace: 1068770796 news1-1.free.fr 10419 81.57.107.149:3458
X-Complaints-To: abuse@proxad.net