Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Harry Gordon 15 posts 92 karma points c-trib
    Mar 21, 2022 @ 17:09
    Harry Gordon
    0

    Can I use the xPath union operator when setting up a Multinode Treepicker?

    Hi all, I'm trying to set-up a picker (Multinode Treepicker) and limit selections to two locations. I've worked out the two queries using the | operator (which is apparently a feature of xPath), for example:

    query1 | query2
    

    The result though is an error when loading the node: "An error occurred / Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function."

    Am I doing something wrong or is this unsupported?

    I'm also happy for other suggestions about how to achieve this. My main requirement is that users can choose nodes of type X from a set of specific parents (type Y) but not all those parents 😵... I can provide a more specific example if that would be helpful!

  • Lucas Michaelsen 32 posts 232 karma points
    Mar 21, 2022 @ 21:09
    Lucas Michaelsen
    1

    Hello Harry,

    I have done something simular to what yo are trying to do.

    $current/ancestor-or-self::*[name()='pFrontpageCampaign' or name()='pFrontpageLocal' or name()='pFrontpageDistric' or name()='pFrontpageMain']//fFAQFolder
    

    or

    [//folderX or //folderY]/child::*
    
  • Harry Gordon 15 posts 92 karma points c-trib
    Mar 22, 2022 @ 07:06
    Harry Gordon
    0

    Thanks Lucas, this was really helpful, my expression does now at least seem to be valid:

    $current/ancestor::*[name() = 'root' or name() = 'project']/sharedResources
    

    Unfortunately the Multinode Treepicker only offers the root resources and not the project resources. I wondered if this was an ordering issue in the or (like in Javascript, offering the first value if it's not empty) but order isn't the issue. If I remove the root clause I am offered the project content, so at least both clauses work.

    It may be worth noting that I'm on Umbraco v9.

    I will keep investigating.

  • Harry Gordon 15 posts 92 karma points c-trib
    Mar 22, 2022 @ 08:15
    Harry Gordon
    0

    I asked about this on Discord and Sebastian said all pickers only support a single root node (to his knowledge) so this is probably not doable.

    Edit: opened a feature request/discussion at Sebasitian's suggestion: https://github.com/umbraco/Umbraco-CMS/discussions/12162

Please Sign in or register to post replies

Write your reply to:

Draft