我正在处理 Orbeon 表单,并且遇到与功能相关的问题,如下所述。 我有一个表单,其中包含如下重复字段,可以通过单击“添加”按钮动态添加该字段。 我在重复部分有两个字段。而且我还有一个条件,例如这些字段必须与同一行中的字段以及上一行和下一行中的字段进行比较。
我有一个这样的实例:
1.constraint="if(.!='')
then
(. < ../two and . > ../preceding::number/two)
else
true()"/>
2.constraint="if(.!='' )
then
(. > ../one and . < ../following-sibling::number/one)
else
true()"/>
<number> is under repeat condition.
1.In this,i am trying to compare number/one with <two> in the same row and the preceding row.
2.In this,i am trying to compare number/two with <one> in the same row and the next preceding row.
I have to add like 10 times of these fields.When it is added after 3rd time,the logic doesn't work properly.
Kindly let me know what happens in this case.
最佳答案
未限定的前置同级和后续同级 xpath 表达式返回所有之前或之后同级的序列。
您需要添加谓词来选择上一个或下一个同级。
所以,对于你的例子:
../preceding-sibling::number[1]/two
或者。更全面
../preceding-sibling::number[position()=1]/two
将返回前一个兄弟“two”元素。
整数比较示例:
(. > xs:integer(../preceding-sibling::number[1]/two))
参见http://blog.orbeon.com/2007/06/xpath-reverse-axis-evil-at-times_04.html了解更多。
问候
杰兹
关于orbeon - 比较 Orbeon 表单中重复部分中的值时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19265905/