Copied to clipboard

Flag this post as spam?

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


  • Matt Taylor 873 posts 2086 karma points
    May 14, 2015 @ 11:25
    Matt Taylor
    0

    XPATH : find ancestor of doctype x for given node?

    It's obviously been too long since I queried with XPATH as I'm struggling with this.

    I've got a node, I know its ID and I know that one of its ancestors further up the tree is of document type 'en'.

    How do I find that that 'en' node?

    Thanks in advance.

    Matt

  • Matt Taylor 873 posts 2086 karma points
    May 14, 2015 @ 12:32
    Matt Taylor
    101

    Easier after a night's sleep. :-)

    //*[@id=" + node.Id + "]/ancestor::Lang [@isDoc]

    'Lang' = doc type alias you're looking for.

  • Urvish 252 posts 776 karma points
    May 14, 2015 @ 12:33
    Urvish
    0

    Hi Matt,

    If you have IPublishedContent node then you can get ancestors using below.

    node.Ancestor("en")
    

    Hope it will help.

    Regards,

    Urvish Mandaliya

  • Matt Taylor 873 posts 2086 karma points
    May 14, 2015 @ 14:15
    Matt Taylor
    0

    Thanks Urvish,

    I don't because it's Umbraco 4.7.

    Regards, Matt

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies