Given XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<c cid="0">
<d did="c0d0" d1="2015-02-11" d2="2015-06-15" />
<d did="c0d1" d1="2015-04-01" d2="2015-04-14" />
</c>
<c cid="1">
<d did="c1d0" d1="2014-11-15" d2="2015-07-21" />
<d did="c1d1" d1="2016-02-10" d2="2016-02-25" />
</c>
</root>
Using XPath 3.0 I have to find all c
nodes, which has at least one d
child node, which d2-d1
attributes values difference is less or equal 30 days. d1
and d2
values are dates in YYYY-MM-DD
format.
I've tried XPath:
/root/c[d/xs:date(@d2)-d/xs:date(@d1)<=30]
but I've got and error:
Cannot compare xs:dayTimeDuration to xs:integer
I use XPath Builder
in XPath 3.0
mode in Oxygen XML Editor v18
.
I suppose that this error is due to incorrect time duration setting. Please advice how to specify time duration as literal in XPath 3.0.
Thanks!