2009-12-04 69 views
0

我有一個XForm調查。我想將問題保存在收集答案的xf:instance中的同一模型的單獨xf:instance中。在一個例子中,一個包含10個問題的小組。在第二個例子中,一個小組要持有10個答案。第二例將被提交。所以,這與兩個列表之間的連接相似。XForms,XSLTForms外連接

我已經使用邏輯類似如下嘗試:

<xf:output ref="instance('questions')/question[position()]/@text"></xf:output> 

,但那個位置()總是返回1,因爲上下文是問題XF的:實例。使用索引('current-repeater')將所有10個顯示的問題更新爲最近聚焦的重複迭代索引處的問題。

有沒有辦法使用一個臨時變量在XPath來做到這一點的方法嗎?我試過$變量,甚至各種用途:

<xf:output ref="instance('questions')/question[position() = (count(current()/preceding-sibling::*) + 1)]/@text"></xf:output> 

感謝,

傑森

回答

0

嗯,事實證明,這是目前不支持:

軸,如「前XSLTForms的XPath分析器尚不支持該屬性,該屬性是用XSLT 1.0編寫的。

相反,做一些沿着這些線路:

<xf:instance id="positions"> 
    <data xmlns=""> 
    <position /> 
    </data 
</xf:instance> 

... 

<xf:setvalue ref="instance('positions')/position">1</xf:setvalue> 
<xf:setvalue ref="instance('positions')/position" value="count(instance('main')/path/to/things/thing)-1" /> 
etc. 

然後使用它們:

<xf:input ref="path/to/things/thing[instance('positions')/position]"> ... 

[email protected]