Problem with libxml2/libxlst

C

CinnamonDonkey

Hi All,

I could not find a dedicated libxml2/libxlst group so I thought I
would see if anyone here could help.

I have a system which captures the stdout from various sources and
writes it into a generic xml file. This file then needs to be
transformed to get the correct html format for rendering in a
webserver.

I am using the following code to perform the translation:

styledoc = libxml2.parseFile('stdout.xsl')
style = libxslt.parseStylesheetDoc(styledoc)

doc = libxml2.parseFile('stdout.xml')
result = style.applyStylesheet(doc, None)

style.saveResultToFilename('stdout.html'), result, 0)

style.freeStylesheet()
doc.freeDoc()
result.freeDoc()

Given the following stdout.xml sample:

<report>
<stdout>some app spew...</stdout>
<stdout>laa laaa laa...</stdout>
<stdout>something interesting &lt;badthinghappening&gt;</stdout>
</report>

It seems that the resultant 'stdout.html' file shows the final stdout
message translated too:

<stdout>something interesting <badthinghappening></stdout>

which of course results in a badly formed file with a missing tag :(

How do I get libxml2/libxlst to not touch the '&lt;' and '&gt;'

Cheers
-Shaun
 
C

CinnamonDonkey

My mistake! *doh*

I had an 'disable-output-escape="YES"' when it should have been "NO".

-Shaun
 
S

Stephen Hansen

My mistake! *doh*

I had an 'disable-output-escape="YES"' when it should have been "NO".

-Shaun

Eeeeven though you figured out your problem: have you checked out lxml?
Its extremely capable and ISTM much easier to use then whatever direct
wrapper you seem to be using.

Check out: http://codespeak.net/lxml/xpathxslt.html#xslt

--

Stephen Hansen
... me+list/python (AT) ixokai (DOT) io


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
Comment: Public key available at: http://killnine.net/shansen.pub

iQEcBAEBAgAGBQJMEQcqAAoJEKcbwptVWx/lYxQIALFdMLIgsTwc+7+kz0v386lO
5SOKnI+1y15gtMr1XfCacTeK/ZNn/Rm5hKUMd80YzD5LN2ft33cuhC+29DHyfCIS
se/DOxDKYmJM/c1S5HJtMTwZDSAp+T08i2C7AuIJyKIYnIslN7KoGPcazOQe/V3L
674uvpUdMKqHz2eo3Glo1flg5O4gnWy+/gGvJ7r2aUo1WoZ0p35VCrVgi/D0x/fR
ouDJvWA8oALa6PwmJN6vw8469BWW4aQbEjxKBbkxCKyazyYskQQxY13XIa1VYQ0H
vDUYwfafBhbBv/+YnJkVM6Kx96CE0HKXWaRburFeu6ZB4UgTvtaXCv84aUrXE4c=
=q1TR
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top