Copied to clipboard

Flag this post as spam?

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

  • Ella Jennings 1 post 71 karma points
    Mar 29, 2018 @ 09:04
    Ella Jennings

    Xpath query by node name in Umbraco 7.1.9


    We are trying to use Xpath to select the folder a user will start at when using a multi-node tree picker in umbraco 7.1.9

    --> Home -----> Your Product ----------> Child 1 ----------> Child 2 -----> Other Top Level Node

    If the node doctype is ProductPage and the name of it is Your Product:

    /root/Home/ProductPage allows us to select the specific doctype.

    However as this doctype will be changing in future, but keeping the same name we need to be able to select on the string 'Your Product'.

    None of the options we have tried seem to work, even those based off other projects that are in different versions of umbraco, e.g. $site//descendant::*[@isDoc][name = 'Your Product'] which is based off a query that works in umbraco 7.5.3.

    Does anyone know how to solve this?

  • Dave Woestenborghs 3252 posts 11032 karma points MVP 5x admin c-trib
    Mar 31, 2018 @ 08:22
    Dave Woestenborghs

    Hi Ella,

    You say the node type is changing in the future. The best option is to change your xpath when this happens.

    Because doing this on name is even less save. The name of item can be changed by editors and that will break your xpath query as well.

    You can instruct your editors not to change the name, but at some point they will..Trust me


  • Steve Morgan 1208 posts 3922 karma points c-trib
    Jun 11, 2020 @ 14:02
    Steve Morgan


    To pick up an old thread - but because I needed similar and probably will need my own answer in the future... you need @nodeName

    $root/configuration/configuration[@nodeName ="Blog Filter 1"]

Please Sign in or register to post replies

Write your reply to: