2009-12-04 73 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]