in reply to Re^3: XML parsing and Lists
in thread XML parsing and Lists

Hello! Tried the xpathcontext approach and works great. However, I do need to check for the condition: "Where H4 contains Include". The document can have multiple sections as above and I only need to count the list elements of this particular section only.

This is the expression I am trying, which I know is wrong since this is now looking under H4. I am not sure if its even possible to combine the two conditions at all in one expression. So looking for some help here.

objective:counting the number of LI under //Article//Main//Sect where value of H4 contains "include"

$count = $dom->findvalue("count(//Article//Main//Sect//H4[contains(.,\ +"Include\")]/LI)"); print $count;

greatly appreciate any help in this regard. Thanks!

Replies are listed 'Best First'.
Re^5: XML parsing and Lists
by choroba (Cardinal) on Jul 05, 2013 at 08:41 UTC
    LI is not part of the H4. Move H4 into the condition:
    'count(//Article//Sect[contains(H4,"Include")]//LI)'
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ