Hi Danny,
So long as you have an appropriate element range index mapped to month (for
example: decimal) you should be able to use an element range query like this to
get the result:
cts:search(/documents, cts:element-range-query(xs:QName("month"), "=",
xs:decimal("1")))
cts:element-value-query only looks for strings of an exact match.
One alternative to keep using cts:element-value-query would be to do this and
search for both possibilities:
cts:search(/documents, cts:or-query((
cts:element-value-query(xs:QName("month"), "1"),
cts:element-value-query(xs:QName("month"), "01")
)))
Best,
Rob
Rob Szkutak
Associate Consultant
MarkLogic Corporation
[email protected]
Cell +1.716.562.8464
www.marklgoic.com<http://www.marklogic.com>
________________________________
From: [email protected]
[[email protected]] on behalf of Danny Sinang
[[email protected]]
Sent: Friday, October 03, 2014 7:47 AM
To: general
Subject: [MarkLogic Dev General] cts:element-value-query : how to match month =
"01" or "1"
We have some documents having :
<month>01</month>
and other docs having :
<month>1</month>.
Is there a way to make cts:element-value-query () consider both months as the
same ?
Regards,
Danny
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general