On Tue, Jun 10, 2014 at 2:21 AM, Amit Kumar Dev <[email protected]>
wrote:
> Hi Chris,
>
> I am trying to search for xpath
> "/mat:employee/mat:joining/mat:date/@mat:date-value".
>
> I am having below xml structure:
> <mat:employee>
> <mat:joining>
> <mat:joining-date>20120605</mat:joining-date>
> <mat:date mat:date-value="2012-06-05" >20120605</mat:date>
> <mat:joining>
> <mat:resignation>
> <mat: resignation -date>20130605</mat:resignation-date>
> <mat:date mat:date-value="2013-06-05" >20130605</mat:date>
> <mat:resignation>
> </mat:employee>
>
>
If you want to search for documents with a certain joining-date, then you
could search for any mat:employee with a certain date value inside
mat:joining:
cts:search (/mat:employee,
cts:element-query (xs:QName ('mat:joining'),
cts:element-attribute-value-query (xs:QName ('mat:date'), xs:QName
('mat:date-value'), '2012-06-05')
)
)
The same element-query in xml format:
<cts:element-query xmlns:cts="http://marklogic.com/cts">
<cts:element xmlns:mat="mat">mat:joining</cts:element>
<cts:element-attribute-value-query>
<cts:element xmlns:mat="mat">mat:date</cts:element>
<cts:attribute xmlns:mat="mat">mat:date-value</cts:attribute>
<cts:text xml:lang="en">2012-06-05</cts:text>
</cts:element-attribute-value-query>
</cts:element-query>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general