2

我正在处理 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.
4

1 回答 1

3

不合格的前同级和后同级 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

问候

杰兹

于 2013-10-09T09:35:24.180 回答