I have problem with my path to XML-elements. In XML document I have:
<team id="6">
<refer>
<team IDREF="7"/>
<team IDREF="8"/>
</refer>
</team>
<team id="7">
<refer>
<team IDREF="6"/>
<team IDREF="8"/>
</refer>
</team>
<team id="8">
<refer>
<team IDREF="6"/>
<team IDREF="7"/>
</refer>
</team>
And I want action -> click refer for team with id=6, and print refers children (two elements -> 7 and 8). I tried this path:
for $z in $path/team[@id = $path/team[@id=$id]/refer/team/@idref]
Where $id is variable id from chosed team (in eg. $id=6), but it doesn't work. I have empty return from this path. Thanks for every help!
EDIT:
I have described it badly. I wanted return whole elements <team id="7">...</team>
id and <team id="8">...</team>
I tried this ($path is doc("input.xml")/root):
for $z in $path/team[@id = $path/team[@id=$id]/refer/team/@idref]
What is badly in this path?
EDIT2: XML document has only this:
<root>
<team id="1">
<ele1/>
<ele2/>
<refer>
<team idref="2"/>
<team idref="3"/>
</refer>
</team>
<team id="2">
<ele1/>
<ele2/>
<refer>
<team idref="3"/>
</refer>
</team>
<team id="3">
<ele1/>
<ele2/>
<refer>
<team idref="1"/>
</refer>
</team>
</root>
And it should return me whole
<team id="1">
<ele1/>
<ele2/>
<refer>
<team idref="2"/>
<team idref="3"/>
</refer>
</team>
with childrens elements when $id=3.