madbee has asked for the wisdom of the Perl Monks concerning the following question:
Hello!This is in reference to: Title:XML parsing and Lists
For the below xml file: <Aritcle> <Main> <Sect> <H4>Include</H4> ..... <P1> This is the criteria</P1> <L> <LI> <LI_Label>1.</LI_Label> <LI_Title>Critera 1</LI_Title> </LI> <LI> <LI_Label>2.</LI_Label> <LI_Title>Critera 2</LI_Title> </LI> <LI> <LI_Label>3.</LI_Label> <LI_Title>Critera 3</LI_Title> </LI> <LI> <LI_Label>4.</LI_Label> <LI_Title>Critera 3</LI_Title> </LI> </Sect> </Main> </Article>
I need to get the count of LI elements where H4 = "include". The document I am working with can have multiple Sections and headers. But only for Header = "Include", I need to get the total count of LI elements only.
From the referenced link, I understand we can do this using XpathContext: xdom->find(count(path));.
However, I am not sure how I could filter it by the value of the Header element. Is it possible in 1 XPath expression? If so, can someone please give an example of how this can be done or point me to an example where this has been done already?
Thanks so much in advance.
madbee
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Counting number of child nodes based on element value
by sahil2588 (Novice) on Jul 05, 2013 at 08:00 UTC | |
by Anonymous Monk on Jul 05, 2013 at 08:06 UTC | |
|
Re: Counting number of child nodes based on element value
by sahil2588 (Novice) on Jul 05, 2013 at 08:11 UTC | |
|
Re: Counting number of child nodes based on element value (typos)
by Anonymous Monk on Jul 05, 2013 at 08:22 UTC |