Combining Class and Nth-Child in Perl TreeBuilder and XPath -
i trying sum of column in html table. first row of table titles. every cell of every row past first has class "right", going use class selector ignore unnecessary titles. however, need second cell of each row. how combine these 2 selectors? right?
my $tree = html::treebuilder::xpath->new_from_file($filename); foreach $value ($tree->findnodes('//table/tr/td[@class="right"[position()=2]')){ stuff; }
you can combine predicates putting 1 after another:
//table/tr/td[@class="right"][2]
or, can use logical and
//table/tr/td[@class="right" , position()=2]
Comments
Post a Comment