XPath JCR Sample Queries

Beginning in version R28, XperienCentral no longer uses the Apache Jackrabbit JCR index solution by default. This topic is only relevant to users of XperienCentral versions R27 and lower. See the XperienCentral upgrades notes for version R28 for more information.


This topic contains some example XPath queries that can be used in the XperienCentral JCR browser. Jackrabbit supports a subset of XPath 2.0 which is a subset of XQuery1.0). See also JCR Browser for complete information and other examples.


  • Retrieve all templates:
    //element(*, wm:template)
  • Retrieve the template with ID = X:
    //element(*, wm:template)[@wm:templateid=1190]
  • Retrieve the Siteworks object with ID = X:
    //element(*)[@wm:id=72430]
  • Retrieve all objecttypes:
    //wm:webmanager//element(*, wm:objecttypeinfo)
  • Retrieve the webpage item with Siteworks name "Queries":
    //wm:webmanager/wm:websites/wo:webpage_item[@wm:name = 'Queries']
  • Retrieve the web page item with reference to the node Siteworks object of objecttype itemtype and name "370eea2b4dcbba2700212ab636f5":
    wm:webmanager/wm:websites/wo:webpage_item/jcr:deref(@wo:itemtype, '370eea2b4dcbba2700212ab636f5')
  • Retrieve the JCR item with UUID "8d38de7b-cec9-4fd6-a714-65e1a61b5bba":
    //*[@jcr:uuid='8d38de7b-cec9-4fd6-a714-65e1a61b5bba']
    Or
    //element(*)[@jcr:uuid='8d38de7b-cec9-4fd6-a714-65e1a61b5bba']
  • Retrieve all SiteWorks tasks:
    //element(*, wo:wm_taskmanager_task)
  • Retrieve all web pages, in descending name order
    //element(*, wo:ss_mastersection) order by @wm:name descending
  • Retrieve all objects of the given objecttype
    //element(*)[@jcr:primaryType='wo:personalization_expression']
  • Retrieve all paragraph elements containing the text "XX"
    //element(*, wo:ss_element_text ) [@wo:text='XX']
  • Retrieve all objects of type X with property Y:
    //element(*, X)[@Y]
  • Retrieve all objects of type X without property Y:
    //element(*, X)[not(@Y)]
  • Find nodes containing a property with value 'XX'
    //* [jcr:contains(@*,'XX')]
  • Find all elements containing "XX" that use wo:text to save their data (rich text, paragraph, etc.)
    //* [jcr:contains(@wo:text,'*XX*')]
  • Retrieve a list of XperienCentral language labels in the edit environment:
    //element(*, wo:wm_edit_language)
  • Retrieve a list of all webinitiatives
    //element(*, wo:wm_webinitiatif)
  • Retrieve a list of ss_element_external_content where "last X days" > 100:
    //element(*, wo:ss_element_external_content) [@wo:lastxdays>100]
  • When comparing date properties, use the xs:dateTime function. JackRabbit only accepts a fully specified date, including the time in milliseconds:
    //element(*, wo:wm_content_info)[@wo:lastmodified < xs:dateTime('2008-01-01T00:00:00.000Z')]
  • Retrieve the metadata of a media item
    1. Get the exact type of the mediaitem: //wm:components
    2. Hex-code the first number in the media item contentid (e.g. for mediaitem 202209, encode '2' into 0032 via the [http://www.easycalculation.com/ascii-hex.php] site)
    3. Retrieve the meta data using //<exact-type>/allContainerNode/_x<hex>_restofnumber (e.g. //nl.gx.elsevier.elseviermediaitems.AbonneeMediaItemVersionImpl/allContainerNode/_x0032_02209
  • Retrieve a link which refers to a page on the nu.nl website:
    //element(*, wo:ss_element_internal_externallink)[jcr:like(@wo:URL,'http://www.nu.nl/%')]

  • Retrieve all pages which have a link that refers to a page on the nu.nl website:
    //element(*, wo:ss_section)[jcr:like(wo:related/wo:URL,'http://www.nu.nl/%')]

  • Retrieve all articles (element holders) which have a link that refers to a page on the nu.nl website:
    //element(*, wo:wm_element_holder)[jcr:like(wo:related/wo:URL,'http://www.nu.nl/%')]

  • Retrieve all page versions which have a preload form attribute

    //element(*, wo:ss_section)[@wo:preload_form]

  • Retrieve all page versions with an element containing the text "XX":

    //element(*, wo:ss_section)[jcr:contains(wo:element/@wo:text,'*XX*')]

  • Retrieve all pages which contain a specific element

    //element(*,wo:ss_section)[wo:element/@jcr:primaryType = 'mywcb:element']


Although Jackrabbit uses the XQuery grammar, it only implements the set of XPath features required by JCR-170 (and some
extras, like predicates on location steps). For more information about XPath see https://www.w3schools.com/xml/xpath_intro.asp.