XSLT: How to find a node containing TWO matching children?

B

bearclaws

I have the following XML:

<AAA>
<BBB>
<CCC>111</CCC>
<CCC>222</CCC>
</BBB>
<BBB>
<CCC>333</CCC>
<CCC>444</CCC>
</BBB>
</AAA>

....and want to loop through AAA to find all BBBs that contain CCC nodes
matching 333 AND 444.

Any thoughts on the most effecient syntax for this?

Thanks,
BC
 
J

Joris Gillis

Tempore 18:40:18 said:
...and want to loop through AAA to find all BBBs that contain CCC nodes
matching 333 AND 444.
what about "AAA/BBB[CCC='333' and CCC='444']" ?


regards,
 
M

Martin Honnen

bearclaws said:
I have the following XML:

<AAA>
<BBB>
<CCC>111</CCC>
<CCC>222</CCC>
</BBB>
<BBB>
<CCC>333</CCC>
<CCC>444</CCC>
</BBB>
</AAA>

...and want to loop through AAA to find all BBBs that contain CCC nodes
matching 333 AND 444.

If <AAA> is the root element there is not much to loop through, as for
an XPath you would need
/AAA/BBB[CCC = '333' and CCC = '444']
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top