7

Is there any robust XSLT2.0 processor for Perl? I just tried out XML::LibXSLT and it doesn't support analyze-string, regex, etc. I'm afraid of using XML::Saxon::XSLT2 for my work cause it uses Java and I wouldn't want to add that to my list of dependencies. What library do you guys use for XSL2.0 transformations?

Cheers,

Dimitre Novatchev
  • 240,661
  • 26
  • 293
  • 431
Gaurav Dadhania
  • 5,167
  • 8
  • 42
  • 61
  • Look at this question to get some idea http://stackoverflow.com/questions/156683/what-is-the-best-xslt-engine-for-perl – Raghuram Dec 21 '10 at 05:29
  • I did :) However, the answers are over 2 years old and that's a millennium in tech. LibXML, the most recommended module on that thread, does not support XSLT2.0 directives like I mentioned. – Gaurav Dadhania Dec 21 '10 at 05:34
  • So you're looking for an XSLT 2.0 processor written in Perl? (I don't know how else you would avoid adding dependencies.) – LarsH Dec 21 '10 at 05:49
  • Preferably, yes. Though, if I have no other choice, I wouldn't mind using something else. It's just that there are a lot of problems with the interfaces between the languages (eg: XML::Saxon::XSLT2 uses Java) and debugging is a nightmare! – Gaurav Dadhania Dec 21 '10 at 05:59
  • http://www.explain.com.au/libx is a project to add XSLT and XPath 2.0 support to libxml/xslt. It is however far from finished (http://www.explain.com.au/libx/compliance.html). – Martin Honnen Dec 21 '10 at 12:16
  • @MartinHonnen: Irrespective of future plans, LibX is not Free/Open Source Software. As libXML is MIT licensed, this is completely allowed. I do appreciate their desire to release something FOSS, but at this time it's irrelevant. If non-free options are to be considered, Altova has a great CMD line XSLT 2.0 Processor. Unfortunately neither is game changing, we need a FOSS XSLT 2.0 Lib to fix this widespread deficiency. Additionally the lib must be written in C, or at the bare-minimum C++. Although to be 100% widespread, C is preferable, Which is why libXML is so ubiquitous – J. M. Becker Nov 01 '12 at 18:23

1 Answers1

7

So you're looking for an XSLT 2.0 processor written in Perl?

No, you most definitely do not want a pure-Perl XSLT processor. The result would be excruciatingly slow and memory intensive, not to mention you want a library that's been thoroughly tested in the field by a much larger user base than the comparatively few people that do XSLT in Perl. That's why LibXSLT is so popular, since it's a fast and solid C library with a minimal Perl wrapper around it. And unless you're using a GUI debugger like Komodo with breakpoints and variable inspection, debugging isn't really much more complicated.

But to answer your question: The only fully compliant XSLT 2.0 processor available today is Saxon, available as a fully featured commercial Java library and a stripped-down open source version – both incidentally made by the same guy who wrote the XSLT 2.0 spec (I wonder which were written first?). Given the complexity of the spec, it seems likely to remain that way for a long time.

So, if using a Java library is undesirable, perhaps you should ask yourself whether you really need the complete 2.0 feature list or would be content with using some of the other libraries that slowly and painfully are underway to implementing "XSLT 1.5".

geira
  • 604
  • 5
  • 5