Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
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
Replies are listed 'Best First'.
Re^5: XML parsing and Lists
by choroba (Canon) 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 scrutinizing the Monastery: (10)
As of 2015-07-30 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls