Xqueryの設計に問題があります。 私のXMLは、ポケモンのデータベースのように見えます:イムがやろうとしxqueryを使用した要素内のコンサルティング要素
<species id="a0001">
<name></name>
<description></description>
<type></type>
<type></type> (can have different types)
<type></type>
<attack>
<has-attack id="p01"/>
<has-attack id="p02"/>
</attack>
<evolution>
<species id="a0002">
.
.
.
<evolution>
<species id="a0003">
.
.
.
</species>
</evolution>
</species>
<species id="a0004">
.
.
.
</species>
</evolution>
</species>
何を、タイプ「火」ですべての種を取得することです。
declare variable $tipo as xs:string := "Fire";
for $b in doc(".xml")/bd/species
let $nattacks:= count ($b/attacks)
where $b/type= $type
return <result>
{$b/@id}
{$b/name}
<na>{$nattacks}</na>
</result>
しかし、私は任意のヘルプ 、「エボリューション」のラベル内の種にアクセスする方法を知りませんか? har7 @
ずっと整然と可能性があり、それが唯一の第一の種のIDを私に示し= A0001 – aldonair92
あなたは全体のXML内のすべての 'species'要素を見つけるために' // species'を使用することができます: 'doc("。xml ")//種族。その問題は何ですか? – har07
ありがとう、私はあなたが/ /ドキュメント内のすべての要素を見つけるために使用できるか分からなかった。 – aldonair92