I found a useful option to specify the context element in the cts
constructor, but this option is only present in ML 3 document. So in my
case:
cts:search(/root,
cts:element-query(
xs:QName('a'),
cts:element-value-query(
xs:QName('b'),
$value,
*('child')*
)
)
)
child: Specifies the query is satisfied in a child element of the query
context.I don't know why this option cannot be found in ML 4 or 5 document,
but it is still working on ML 4 and 5 version.
On Tue, Feb 7, 2012 at 10:52 AM, John Zhong <[email protected]> wrote:
> Hi all,
>
> I have xmls look like below:
>
> <root>
> <a>
> <b>any text</b>
> <c>
> <b>any text</b>
> </c>
> </a>
> </root>
>
> Now, I want to search /root[a/b = 'value'] by cts constructors, for
> example:
>
> cts:element-query(xs:QName("a"),
> cts:element-value-query(xs:QName("b"), $value)
> )
>
> But this searches all the b element under /root/a, like /root/a/c/b, so I
> want to ask if there is any way to ignore the /root/a/c/b using cts
> constructors? Because I just want to check the /root/a/b. Or I have to use
> XPath like /root[a/b = 'value']? If so, how is the performance between cts
> constructors and XPath?
>
> Thanks,
> John
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general