1

So, I'm trying to work my way to what is essentially a great aunt/uncle of the context item and then looking to its descendents for specific item types.

So there's a folder and within that folder there are multiple organization nodes, and on the same level as those is another that is called 'All Organization'. Within that are items that I want to look for. So my attempt at trying to do this failed, but here it is:

 ancestor::*[@@Templatename='Folder']/[@@name = startswith('All ')//*[@@templatename='Author']

When I try the following on it's own:

 ancestor::*[@@Templatename='Folder']

It actually shows two folders not one, which seems strange, since I thought this was just supposed to yield the closest ancestor that matched the query, not multiple? But regardless, I'm wondering startswith can be used like this, and if so, how can I rewrite the syntax to work?

1 Answer 1

1

ancestor will return multiple matches not just one, but you can apply additional conditions to filter further in your query.

startswith can be used as below,

startswith(filed or property name, 'value') in your case it would be [startswith(@@name,'All')]

You can also try contains which will look for the specific word anywhere in the item/folder name, something like this,

[contains(@@name,'All)]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.