[xslt] get libxslt version via python? debugging transform



Hi,

Sometime in the past 4 months I've upgraded my python bindings to libxml2 and 
libxslt. Today I discover that one of my stylesheets is not working. Yet it does 
work with xsltproc and xml starlet.

Because I'm using an altinstall of python on my RHEL4 Linux system, I use

libxml2-python-2.6.21

to create the bindings.

rpm -q reports

libxml2-2.6.27-1
libxslt-1.1.18-1


After running python2.4 setup.py install -f, I run python2.4 and import libxml2.

But I can't really be sure which version is being used from within python.

Global constants like LIBXML_VERSION_STRING don't seem to exist in the 
python binding.

1. How can I be sure, from which Python, which version of libxml2 and libxslt is 
being used?


2. I am using libxslt from with Python to do a transform. This used to work, I don't 
believe my stylesheet has changed (much), but what really confuses me is that 
the transform works with xsltproc


[bkc server3 tal2xslt]$ xsltproc --version
Using libxml 20627, libxslt 10118 and libexslt 813
xsltproc was compiled against libxml 20627, libxslt 10118 and libexslt 813
libxslt 10118 was compiled against libxml 20627
libexslt 813 was compiled against libxml 20627


and xml starlet (which uses a really old libxslt)

Basically I am getting an error calling <apply-templates select="@*" />

where

        <xsl:template match="@*">
                <xsl:if
                        test="namespace-uri() != 'http://xml.zope.org/namespaces/tal' and 
namespace-uri() != 'http://xml.zope.org/namespaces/metal'">
                        <xsl:copy-of select="." />
                </xsl:if>
        </xsl:template>

The error is

runtime error: file /home/bkc/src/eclipse/main24/tal2xslt/tal2xslt/xsl/tal2xslt.xsl line 
401 element copy-of
Attribute nodes must be added before any child nodes to an element.

I understand what the error means, but debugging this is really difficult. It'd be a 
lot easier if I could find out which <apply-template call  /> was being executed, or 
even if I knew the current output element name. Or if I could see what had been 
serialized up to this point.

Any suggestions on how to debug this? 

Any idea why it works with xsltproc, but not via Python? I am thinking a version 
difference but I can't be sure which libxslt version I'm using from Python..

Thanks for any suggestions!



-- 
Brad Clements,                bkc murkworks com    (315)268-1000
http://www.murkworks.com                          
AOL-IM or SKYPE: BKClements




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]