After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 139825 - XML::LibXSLT::xpath_to_string does not correctly parse strings with ' that do not end in '
XML::LibXSLT::xpath_to_string does not correctly parse strings with ' that do...
Status: VERIFIED NOTGNOME
Product: libxslt
Classification: Platform
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2004-04-12 18:03 UTC by Christina Norman
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christina Norman 2004-04-12 18:03:46 UTC
Program:
    use XML::LibXSLT;
    my @result = XML::LibXSLT::xpath_to_string("title","Bob's Burgers");
    print $result[0]." is ".$result[1]."\n";

Output:
    title is concat('Bob', "'", 's Burgers', "'")

Correct Output:
    title is concat('Bob', "'", 's Burgers')

Commentary: This is caused because the fundamental parse operation is to append ' to chunks split by 
'.

My fix is:
        if ($value =~ /\'/) {
            $results[-1] = join('', 
                "concat(", 
                        join(', ', 
                                map { "'$_', \"'\"" }
                                split /\'/, $value), 
                                ")");
            # drop trailing ' if source string didn't have it
            if ($value !~ /'$/) {
              $results[-1] =~ s/, "\'"\)$/\)/;
            }
        }
Comment 1 Daniel Veillard 2004-05-16 20:49:22 UTC
I'm sorry but this bugzilla is for the libxslt C library, it does not cover
the perl module using it, try to contact the author,

Daniel