xml - Xpath count number of element with different id and return parent id -


i have following xml

<pizzeria>     <menu>         <pizza codice="p1" nome="marinara" prezzo="3"/>         <pizza codice="p2" nome="margherita" prezzo="4"/>         <pizza codice="p3" nome="prosciutto" prezzo="5"/>         <pizza codice="p4" nome="prosciutto e funghi" prezzo="5.5"/>         <pizza codice="p5" nome="crudaiola" prezzo="7"/>         <pizza codice="p6" nome="tartufo" prezzo="8"/>     </menu>     <tavoli>         <tavolo id="t01">             <pizza codice="p5" qta="2"/>             <pizza codice="p1" qta="1"/>             <pizza codice="p2" qta="3"/>         </tavolo>         <tavolo id="t02">             <pizza codice="p3" qta="1"/>             <pizza codice="p4" qta="2"/>         </tavolo>         <tavolo id="t03">             <pizza codice="p3" qta="3"/>             <pizza codice="p2" qta="4"/>             <pizza codice="p4" qta="2"/>         </tavolo>         <tavolo id="t04">             <pizza codice="p2" qta="2"/>             <pizza codice="p5" qta="1"/>         </tavolo>     </tavoli> </pizzeria> 

now have find elements "tavolo" @ least 3 elements "pizza" , return they're id (of tavolo). can tell me how do? help.

you're looking query:

/pizzeria/tavoli/tavolo[count(pizza) >= 3]/@id 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -