全体の高さが 4 インチのアイテムを検索:
cts:search の使用について質問があります。次の xml を検討してください。
<Item Id="07123114-5c14-4ba9-a6ad-7b688feb8706" ...>
...
<AttributeValue AttributeName="Mounting Application" AttributeGroup="Search_Application">Tank</AttributeValue>
<AttributeValue AttributeName="Type" AttributeGroup="Search_Type">Pump Mounting Bracket</AttributeValue>
<AttributeValue AttributeName="Overall Width" AttributeGroup="Search_Width">15/16 "</AttributeValue>
<AttributeValue AttributeName="Overall Height" AttributeGroup="Search_Height">1-3/8 "</AttributeValue>
...
</Item>
全体の高さ = 4" のアイテムを探したいとしましょう。
cts:search で次のクエリを使用しています。
cts:search(/tx:Item,
cts:element-query(xs:QName("tx:AttributeValue"), cts:and-query((
cts:element-attribute-value-query(xs:QName("tx:AttributeValue"), xs:QName("AttributeName"), "Overall Height"),
cts:word-query("4 """, "exact"))))
)
これにより、全体の高さが 4 インチ、1/4 インチ、3/4 インチなどのすべてのアイテムが表示されます。これは、単語クエリが「含む」検索を行うためです。しかし、正確な値の一致. element-value-query は element-query にラップされているため実行できません (element-value はサブ要素ではありません)。
現在、xml 構造を変更する 2 つの方法があります。オプション 1. 値を AttributeValue 要素の属性にする。オプション 2. 子要素にします。
xml 構造を変更せずに探しているものを取得する方法が必要だと思います。お知らせ下さい。