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

Hi,

i support a Perl written tool that (among other tasks) applies xpath expressions to xml input. It uses XML::LibXML and works fine for XPath 1.0 expressions. Now some users require to use XPath 2.0. I allready knew that this is not supported by XML::LibXML so i searched via both, google and CPAN, but found nothing.

Is there really no perl module supporting XPath 2.0?

Of course, i could use an external tool and manage the Perl script to call it, but a Perl module would be more convenient.

  • Comment on Is there really no Perl module supporting XPath 2.0?

Replies are listed 'Best First'.
Re: Is there really no Perl module supporting XPath 2.0?
by choroba (Cardinal) on Jan 12, 2021 at 09:35 UTC
    XML::XSH2 implemented lots of things planned for XPath 2.0 via the xsh: namespace. If you love adventure you might try to try something similar :-)

    Unfortunately, libxml2 is broken, anyway.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      Thanks, i'll have a look at it.
Re: Is there really no Perl module supporting XPath 2.0?
by Corion (Patriarch) on Jan 12, 2021 at 08:28 UTC

    What libraries do support XPath 2?

    If you find such a library, maybe it is already ported. I think that SAXON supports XPath 2, and there are SAXON modules. Maybe Alien::Saxon is enough to get Saxon into Perl?

Re: Is there really no Perl module supporting XPath 2.0?
by kcott (Archbishop) on Jan 13, 2021 at 00:08 UTC
Re: Is there really no Perl module supporting XPath 2.0?
by Anonymous Monk on Jan 12, 2021 at 17:14 UTC
    Does LibXML (and the underlying binary library) have plans to add support for 2.0 in the future? I'd expect that they would, but have there been any announcements?
        Well, that was 2007 ...