问题
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,
回答1:
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".
来源:https://stackoverflow.com/questions/4496515/xslt2-0-processor-for-perl