prasadbabu has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
Thanks for the replies given for my yesterday post XML::Twig 'cut' and 'paste' Question and it helped me to identify the problem. To get around that problem we came up with new idea by filtering in XPath expression itself. So instead of filtering that in loop we decided to filter using XPath Expressions like these '/article//fig[label and caption]//label', '/article/fig[label and caption]/label'. It is a valid XPath Expressiong. When i tested the XPath Expressions using XSLT it is working fine but through Twig it fails.
use strict; use XML::Twig; my $twig = new XML::Twig( ); $twig->parsefile('1.xml'); my $count = $twig->get_xpath('/article/fig[label and caption]/label'); + $twig->print; print "$count";
Error: ------ error in xpath expression /article/fig[label and caption]/label at lab +el and c aption at C:/Perl/site/lib/XML/Twig.pm line 2784
When i tried that by using the above code, it is giving error as shown above. Is it not possible to use that XPath expression in Twig. Why the error?
Thanks in advance
Prasad
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Twig Question
by Tanktalus (Canon) on Jul 29, 2006 at 14:40 UTC | |
|
Re: XML::Twig Question
by Ieronim (Friar) on Jul 29, 2006 at 19:59 UTC |