嗨我正在嘗試使用XPath動態顯示/隱藏我的XForms下拉列表中的選項。在XForms下拉列表中顯示/隱藏標籤
這裏是我的下拉列表中的XML:
<xml_someField>
<label>Podmiot</label>
<hint/>
<help/>
<alert/>
<item>
<label>1</label>
<value>1</value>
</item>
<item>
<label>2</label>
<value>2</value>
</item>
<item>
<label>3</label>
<value>3</value>
</item>
<item>
<label>4</label>
<value>4</value>
</item>
</xml_someField>
基本上我有一個other_field
這給我示例輸出 - 1,1 2 1 3 1 2 3 4等。取決於我在另一個組合框中檢查的內容。
所以,在我的下拉列表中計算我寫了一個XPath表達式
if(//other_field != '') then
if(//other_field castable as xs:integer) then
//other_field
else .
else
false()
如果我從other_field只有一個號碼拿到 - 1,2,3或4它的工作,它填補我xml_someField與選定的數量,但如果我得到更多然後例如 - 2 3 4或1 3 4它也給我也選擇所有4個選項。
所有我想要的是,當我得到1 3 4,在我的下拉列表顯示1,2和3個選項,而4
我可以使用識別號
if(contains(//othe_field, '1') then
但什麼接下來,是否有任何方法顯示/隱藏項目標籤或值?
//other_field/item/label[text() = '1'] = false()
我應該寫這計算或約束也許更好嗎?