为什么distinct-values不会在非雾化序列上产生不同的值

时间:2017-08-27 11:08:04

标签: xpath distinct-values

为什么

wrapper.instance().handleUnauth()

产量20170101 20170301 20170101 20170501(即重复未删除)

但将其应用于序列的雾化版本

(<benefitStartDate>20170101</benefitStartDate>,<benefitEndDate>20170301</benefitEndDate>, <benefitStartDate>20170101</benefitStartDate>,<benefitEndDate>20170501</benefitEndDate>)/distinct-values(.) 收益

20170701 20170301 20170501

1 个答案:

答案 0 :(得分:3)

(
  <benefitStartDate>20170101</benefitStartDate>,<benefitEndDate>20170301</benefitEndDate>,
  <benefitStartDate>20170101</benefitStartDate>,<benefitEndDate>20170501</benefitEndDate>
)/distinct-values(.)

与:

不同
distinct-values(
  <benefitStartDate>20170101</benefitStartDate>,<benefitEndDate>20170301</benefitEndDate>,
  <benefitStartDate>20170101</benefitStartDate>,<benefitEndDate>20170501</benefitEndDate>
)

后者返回元素序列的不同值。

您的代码返回每个元素的distinct-values,就像调用:

(
  distinct-values(<benefitStartDate>20170101</benefitStartDate>),
  distinct-values(<benefitEndDate>20170301</benefitEndDate>),
  distinct-values(<benefitStartDate>20170101</benefitStartDate>),
  distinct-values(<benefitEndDate>20170501</benefitEndDate>)
)

另一种返回预期结果的变体是:

(
  <benefitStartDate>20170101</benefitStartDate>,<benefitEndDate>20170301</benefitEndDate>,
  <benefitStartDate>20170101</benefitStartDate>,<benefitEndDate>20170501</benefitEndDate>
) => distinct-values()

最佳

迈克尔