Copied to clipboard

Flag this post as spam?

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


  • Martijn 7 posts 88 karma points
    Nov 05, 2019 @ 15:50
    Martijn
    1

    How to use XPath in a Multi Node Tree Picker to filter on property value?

    I have the following content tree

    Home1 Home2 - products -> MNTP -> xpath select contactpersons where show=1 ContactPersons - ContactPerson1 -> show= 1 - ContactPerson2 > show= 2

    So I have three root nodes (Home1, Home2 and ContactPersons). In Home2 I have a document type Products which has a MultiNode Tree Picker for ContactPersons. The Contact person doc type has a property named 'show'. In the MNTP of Products I only want to choose contact persons where show has the value of 2.

    The 'show' property is a Checkbox list with predefined values 1 and 2.

    What XPath expression do I need to use so that I can filter the contact persons?

    I now use //ContactPersons and this give me a list of all the contact persons, but I can't get the filter to work.

    //ContactPersons[ContactPerson] same result as //ContactPersons

    //ContactPersons[ContactPerson[@show=2]] shows me the complete tree node

    etc.

    I hope you can help me :)

  • Damien Holley 180 posts 541 karma points
    Feb 23, 2021 @ 23:46
    Damien Holley
    0

    +1 to this, it has been 3+ years and xpath is still flakey (operating differently to the standard) and largely undocumented.

  • Elisha 1 post 71 karma points
    Mar 03, 2021 @ 04:33
    Elisha
    0

    Something you could try is using the $currentPage variable as the starting point for your XPath expression. Something like the following example which is off the top my head and untested but worth a try Upsers

    $currentPage//product or

    $currentPage/descendant-or-self::Product If you post up your current XPath expression it may also help others to understand where you are at already and provide more specific help.

Please Sign in or register to post replies

Write your reply to:

Draft