It seems that there's a mismatch between what is a valid XML name (which is what XPath is supposed to be working with) and what is a valid JCR node name.
XPath accepts an XML name in a path [1], which by definition cannot start with a number [2]. JCR says that local node names can start with anything except a few special characters like /:[]|*, which have a special meaning in XPath expressions [3]. It's obvious from these definitions that there are names which are valid in XML but not in JCR (those starting with ":" for example), and names which are valid in JCR but not in XML (those starting with numbers or space, for example). Although XPath is an excellent choice for a query language for a tree structure, the fact that it targets a different technology will sometimes highlight this mismatch. An alternative would be to use something like /content/launches/*[local-name() = '2019'] but this doesn't seem to be supported. So, maybe use JCR-SQL2 instead? Oh, another option, if you can make those node referenceable, you could use their UUID instead of their name: //*[@jcr:uuid='78d6b28d-8c91-4ba8-b2de-bb0434533e88']/my-launch/... [1] https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-NameTest [2] https://www.w3.org/TR/REC-xml/#d0e804 [3] https://docs.adobe.com/docs/en/spec/jcr/2.0/3_Repository_Model.html#3.2.2%20Local%20Names On 8/29/19 11:54 AM, Roy Teeuwen wrote: > Hey all, > > In the framework that we use (AEM) there is a folder structure as following: > > /content/launches/2019/08/29/my-launch/content/site-name > > I would like to do a query to search for subresources in this site, but it > seems that this gives issues because an xpath query cannot take numbers as > path names: > > /jcr:root/content/launches/2019(*)/08/29/my-launch/content/site-name//*[@sling:resourceType='some/components/path']; > expected: jcr:root, /, *, @, (, . > > Is there any way around this to still make it work with xpath queries? Can I > escape it in any way? Or can I say "start the query below > /content/launches/2019/08/29/my-launch/content/site-name so that it doesnt > see the numbers in the query > > Thanks! > Roy > -- Sergiu Dumitriu http://purl.org/net/sergiu
