Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^4: XML parsing and Lists

by madbee (Acolyte)
on Jul 05, 2013 at 04:28 UTC ( #1042582=note: print w/ replies, xml ) Need Help??


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!


Comment on Re^4: XML parsing and Lists
Download Code
Re^5: XML parsing and Lists
by choroba (Abbot) 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)'
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1042582]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2014-07-25 08:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (169 votes), past polls