GNOME Bugzilla – Bug 139825
XML::LibXSLT::xpath_to_string does not correctly parse strings with ' that do not end in '
Last modified: 2009-08-15 18:40:50 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/, "\'"\)$/\)/; } }
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