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
[email protected]
http://xqzone.com/mailman/listinfo/general