There might be something about the scope of the query (first arg to cts:search), but in my experience cts:element-query doesn't include itself in its scope, only its descendants, so I don't think the change you are suggesting will solve his problem? I put in a change request to correct that: it seems like the behavior everyone expects.

-Mike

Danny Sokolsky wrote:
I think the problem is that the cts:element-query is on the "carList"
element, and it should be on the "car" element.
-Danny

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jacob
Meushaw
Sent: Thursday, December 06, 2007 8:58 AM
To: [email protected]
Subject: [MarkLogic Dev General] simple cts:search question

Hello All,

I'm stumped on what must be a very simple cts:search question.

I'm trying to identify documents in my database using cts:search which
match a set of parameters. The case I'm stumped on is where I want to
match on both the value of the element as well as one of it's
attributes.

For example a document might contain:

<carList>
     <car color="green">M3</car>
     <car color="blue">beetle</car>
     <car color="yellow">fiat</car>
     <car color="red">911</car>
</carList>

I can't seem to figure out how to construct a cts query that matches
both the attribute value and the element value of the same element:

cts:element-query(
    xs:QName("carList"),
    cts:and-query((
cts:element-attribute-value-query(xs:QName("car"),QName("","color"),"blu
e"),
        cts:element-value-query(xs:QName("car"),"M3")
    ))
)

This incorrectly matches the example. The M3 is not blue.

Hopefully this makes sense.

Any ideas?

Thanks,
Jake
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to