Copied to clipboard

Flag this post as spam?

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


  • John Ligtenberg 53 posts 214 karma points
    Jun 04, 2015 @ 21:18
    John Ligtenberg
    0

    XPath problem in Xml Dropdown Picker

    In my MultinodeTreepicker I'm able to show a list of equipment with the following XPath query

    $current/ancestor-or-self::HomePage[position()=1]/descendant::StandardEquipmentContainer

    I would expect the following XPath query to show the same nodes with my nuPickers XML Dropdown Picker:

    $current/ancestor-or-self::HomePage[position()=1]/descendant::StandardEquipmentContainer//*

    I haven't been able to get any XPath query with $current or $currentPage working with the nuPickers XML Dropdown Picker. Is this not supported or am I doing something wrong. I'm building a multilingual site, so I would like to start the xpath from the current node and not from the root.

    I'm using version Umbraco version 7.2.6

    Any help would be appreciated.

    John 

     

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Jun 04, 2015 @ 21:57
    Hendy Racher
    1

    Hi John,

    The Xml DataSource supports the following token in an XPath expression:

    $ancestorOrSelf

    so the following should do what you want:

    $ancestorOrSelf/ancestor-or-self::HomePage[position()=1)/descendant::StandardEquipmentContainer

    the string token $ancestorOrSelf is replaced at evaluation time with:

    /descendant::*[@id='x']

    where x is the current id, or the parent id (a new node doesn't yet have a current id)

    HTH,

    Hendy

  • John Ligtenberg 53 posts 214 karma points
    Jun 05, 2015 @ 08:50
    John Ligtenberg
    102

    Hello Hendy,

    Thanks very much! Eventually this XPath expression gave me the equipment items in the StandardEquipmentContainer:

    $ancestorOrSelf/ancestor-or-self::HomePage[position()=1]//StandardEquipmentContainer//StandardEquipment


    John

Please Sign in or register to post replies

Write your reply to:

Draft