If you have a collection with more X-definitions enter the name of X-definition with root XML data:
<xd:def xmlns:xd="http://www.xdef.org/xdef/4.2" name="Example" root="anthill" > <xd:declaration scope="local"> String qry = "for $i in (//anthill) return $i[count(//insect[caste/text()='soldier' and @location=$i/@position]) > 1] /@position"; </xd:declaration> <anthill locality="string(); create xquery(qry); /* xquery returns a string with position of found anthill or null */" /> </xd:def>
Input data
If necessary you can specify the name and namespace of the model:
and namespace:
<forest> <animals> <insect family="anteatersí" location="nexToStrawberry"> <genus>ant</genus> <caste>queen</caste> </insect> <insect family="anteatersí" location="nexToStrawberry"> <genus>ant</genus> <caste>male</caste> </insect> <insect family="anteatersí" location="nexToStrawberry"> <genus>ant</genus> <caste>male</caste> </insect> <insect family="anteatersí" location="nexToStrawberry"> <genus>ant</genus> <caste>soldier</caste> </insect> <insect family="anteatersí" location="underSpruce"> <genus>ant</genus> <caste>queen</caste> </insect> <insect family="anteatersí" location="underSpruce"> <genus>ant</genus> <caste>soldier</caste> </insect> <insect family="anteatersí" location="underSpruce"> <genus>ant</genus> <caste>male</caste> </insect> <insect family="anteatersí" location="underSpruce"> <genus>ant</genus> <caste>soldier</caste> </insect> </animals> <anthill position="nexToStrawberry" /> <anthill position="underSpruce" /> </forest>
You can edit
X-definition
or
Input data