Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Definitive/Favorite Perl XML DOM + XSLT interface?

by lestrrat (Deacon)
on Jan 20, 2002 at 03:30 UTC ( #140147=perlquestion: print w/replies, xml ) Need Help??

lestrrat has asked for the wisdom of the Perl Monks concerning the following question:

This is question is just burning me up. I want to use XML, and I also want to be able to use XSLT for XML transformation. But just WHICH XML/XSLT Perl interface is most preferred? I have so far used XML::DOM and XML::LibXML/XML::LibXSLT and I can't decide, because neither of these seems to be the "definitive" solution for several reasons:

On one hand, to my perception XML::DOM seems to be most widely used. XML::DOM seems to follow the DOM specification, and I feel it's pretty good. But what about doing XSLT transformation? I see that there's XML::XSLT, but that doesn't seem to be quite feature-complete. Hmmm....

Then there's LibXML. I love the fact that it's very fast. XSLT works like magic using LibXSLT. But the interface seems to be a little bit off from what I read on the DOM specifications. Hmmm....

And I'm sure there are other ones out there. But I just can't seem to find THE one to use. So which one(s) do other monks use? Why do you use it over others? Is there things that one set of interfaces can do that the others can't?

Any pointers are appreciated...

(I apologize in advance if I have made any incorrect statements about the features of the afore mentioned modules...)

  • Comment on Definitive/Favorite Perl XML DOM + XSLT interface?

Replies are listed 'Best First'.
Re: Definitive/Favorite Perl XML DOM + XSLT interface?
by thraxil (Prior) on Jan 20, 2002 at 05:06 UTC

    mirod's XML::Twig has become my favorite general purpose XML tool; it's interface is much more sensible than XML::DOM or XML::Parser's. for XSLT, i'm usually working in a web environment so i prefer a framework like axkit or cocoon where i'm not dealing directly with modules at all; i can just write the XSLT and associate it with the XML and be done with it.

    anders pearson

Re: Definitive/Favorite Perl XML DOM + XSLT interface?
by Matts (Deacon) on Jan 20, 2002 at 18:55 UTC
    Yes, it's an admitted fault that XML::LibXML isn't fully compliant to the DOM. The problem is we had to write our own DOM methods on top of the library, because libxml2's idea of "dom" is not the same as the W3C's (because of several reasons I won't go into). If there are areas you consider us particularly lacking, then please submit a bug on

    However now there's a new contender - XML::GDOME, which builds on the libgdome library to provide a full implementation of W3C DOM level 2. If it's conformance you're after primarily, I'd go for GDOME. However I really think you'll miss access to XPath (though that's intended to come with the next release of XML::GDOME, so you may not be waiting much longer).

    As far as XSLT goes, you really can't beat XML::LibXSLT for performance and compliance. It's almost as fast as MSXML's XSLT implementation (the known fastest one), and supports exslt extensions and a number of other niceties.

    Also, I have yet to try it, but I hear XML::GDOME can now convert a tree to XML::LibXML format, which will allow you now to use XML::GDOME trees in XSLT transformations. Neat huh?

      Thanks for you input, everybody... much appreciated.

      Functionality wise I guess I'm now pretty fixed on XML::LibXML + XML::LibXSLT.

      The downside for me is the incompatibility with other CPAN modules, and the fact that I find its documentation really hard to read ( if and when I do get more comfortable with this module, I will contribute documentation. But I'm still a long ways from there ). I guess I could always dump/restore XML between XML::DOM and XML::LibXML if I really need to ... I know it's a waste, but, that's the one sure fool proof way to convert between these two, I think.

      And I will surely be keeping an eye out for XML::GDOME. However, I think that module is still a little too alpha for me to use right now. Thanks for the info, though

Re: Definitive/Favorite Perl XML DOM + XSLT interface?
by stefan k (Curate) on Jan 20, 2002 at 17:16 UTC
    But what about doing XSLT transformation? I see that there's XML::XSLT, but that doesn't seem to be quite feature-complete.

    Now, that's a simple truth and it's really a pity. I wrote a small scale XML webpublishing system and I still need to rely on Saxon be installed. Fact is: Saxon is pretty good software, it's almost fully compliant to the XSLT standard and ... it's Java software. Makes me sad in a way to see that the perl community is far behind the java community in this case.

    So, for the moment I recommend Saxon I can work with it, but it's not perl :(

    Regards... Stefan
    you begin bashing the string with a +42 regexp of confusion

      First of all, Saxon is just an XSLT engine, not a DOM implementation, so the above does not answer the question asked. Second of all, the gnome libxslt engine is faster and almost as compliant as Saxon (I don't think there are any compliance issues left in Saxon, which is probably because Michael Kay is on the W3C XSLT committee). I don't think there are any *known* compliance issues with libxslt, so you really should give XML::LibXSLT a try again. I'm sure if you find some compliance issues Daniel Veillard will be very quick at fixing them.

      You are right of course. I took over the maintenance of XML::XSLT late last year because I had a need for a pure Perl XSLT processor - I hope that I have fixed the more egregious bugs, however I would guess that full XSLT compliance is quite a long way away unless someone with plentiful spare time happens upon the project :)

      In the short term I would recommend that you use XML::LibXSLT if you can build it in your platorm :)


Re: Definitive/Favorite Perl XML DOM + XSLT interface?
by vek (Prior) on Jan 20, 2002 at 11:13 UTC
    Take a peek at Matt Sergeant's axkit to see if that floats your boat.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://140147]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2023-01-30 04:40 GMT
Find Nodes?
    Voting Booth?

    No recent polls found