Susan,
I tried to simplify your test case a little, so that I wouldn't need a
copy of your documents.
let $q := cts:element-value-query(
xs:QName('test'),
('ERSW', 'ERSX', 'ERSY'),
'exact')
for $n in (
<test>ERSX</test>,
<test>ERSX/</test> )
return cts:contains($n, $q)
This returns the results I'd expect: true, false.
Perhaps you can try it out in your environment? Assuming it works as
expected, you could try to narrow down the difference between your query
and this test case.
-- Mike
On 2009-09-25 07:18, Susan Basch wrote:
Hi,
I'm working with a query that handles a list of product codes. In our xml, each document
has its own code in an entrycode element (i.e.:<entryCode>ERSX</entryCode>)
that has an element-range-index. I need to be able to distinguish between a code like
'ERSX' and 'ERSX/', but when I pass in the value 'ERSX,' both are being returned. Here's
what I've got so far:
declare variable $RESOURCE_ELEMENTS as xs:QName* := (xs:QName("entryCode"));
declare variable $RESOURCE_CODES := "EQ964,EQ972,EQ973,EQ982,ER223,ERSX";
let $resourcesQuery :=
if($RESOURCE_CODES ne "") then
cts:element-value-query( $RESOURCE_ELEMENTS, fn:tokenize($RESOURCE_CODES, ",\s*"),
"exact", () )
else
"()"
If I run this first part of the query on its own, I get the results I was
expecting -- ERSX is returned, but not ERSX/
But when I pass that query into the main query, I'm getting back both ERSX and
ERSX/:
let $alpha := "C"
let $titles :=
( cts:search(collection("abce")//taxonomy,
cts:and-query(($resourcesQuery,
cts:element-attribute-value-query(xs:QName("booktitle_sort"),
xs:QName("alphaid"),$alpha)
))) )
for $title in $titles order by $title/booktitle_sort
return element topic {
attribute id {$title/isbn13},
attribute name {$title/booktitle_sort}
}
Is there a better way to handle the query?
Thanks!
Susan
_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general