Identical Xpath query to a sql2 query?

1k views Asked by At

I want identical XPATH query to trhis SQL2 Query.

SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/abc/def]) and ([sling:resourceType] = 'geomatrixx/components/list' )

Is there any tool or link available through which i can convert sql2 query into xpath. or any tutorial if yes then please share the link

1

There are 1 answers

0
balaji On

Below is the equilvalent XPath query.

    /jcr:root/content/abc/def//element(*, cq:Page)[jcr:contains(jcr:content/@sling:resourceType, 'geometrixx/components/list')].

Below are some of the mappings between xpath and sql2 queries respectively.Taken from http://docs.jboss.org/jbossdna/0.7/manuals/reference/html/jcr-query-and-search.html.

      //*                                                SELECT * FROM [nt:base]
      //element(*,my:type)                               SELECT * FROM [my:type]
     //element(*,my:type)/@my:title                      SELECT [my:title] FROM [my:type]
     //element(*,my:type)/(@my:title | @my:text)         SELECT [my:title],[my:text] FROM [my:type]
    //element(*,my:type)/(@my:title union @my:text)      SELECT [my:title],[my:text] FROM [my:type]

Thanks, Balaji