Hello and good day to all!
This is the full code:
#!/usr/bin/perl use XML::XPath; use XML::XPath::XMLParser; open (FILE, 'list.txt'); my @contents=<FILE>; close(FILE); foreach my $content (@contents) { if($content =~ m/(\d+)_(\d+)/) { $vid = $1; $xmlfile = "$vid.mp7.xml"; my $xp = XML::XPath->new(filename => $xmlfile); $var = '/Mpeg7/Description/MultimediaContent/Video/Tem +poralDecomposition/VideoSegment[@id="$content"]/MediaTime/MediaTimePo +int'; my $data = $xp->getNodeText($var); print "$data \n"; }; };
Actually, I found out what was going on by doing the obvious...I changes @id="content" for attribute::id="content" (unabbreviated syntax) and it worked fine...I don't know if it should be reported as a bug! Thanks anyway!
In reply to [fixed]Interpolation of variable in xpath by camelmanos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |