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

Hello, I got xpath invalid expression error message in the code below
my @nodes = $doc->findnodes("/feed/doc/title[text( )=$t]/ancestor::fee +d/doc/abstract/text( )"); foreach my $node (@nodes) { #print $node->data, "\n"; print $t2, ": ", $node->firstChild->data, "\n\n"; }
I got the error message when $t string variable includes a colon ":" and when it does not include colon the script work fine. How could I escape from this error. Thanks.

Motaz

Replies are listed 'Best First'.
Re: xpath invalid expression
by Anonymous Monk on Jan 12, 2012 at 12:10 UTC
Re: xpath invalid expression
by i5513 (Pilgrim) on Jan 12, 2012 at 12:06 UTC
    Did you test it enclosing $t with '?
    Regards