Copied to clipboard

Flag this post as spam?

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


  • Michael Close 3 posts 73 karma points
    Sep 07, 2015 @ 13:51
    Michael Close
    0

    xpath query only working for create, not update

    Hi,

    I trying to create a set-up that allows for multiple blogs. Each blog will have it's own author section. When selecting an author for a blog article you should only be able to select an author for that specific blog. This is the xpath query that I'm using at the moment, it allows me to only select authors for that specific blog when creating a new post. However, when I try to update the author of a blog article it allows me to select from all authors.

    $parent/../../child::*[BlogAuthorPage]

    Hope that makes sense. Any help is appreciated. Thanks.

  • Michael Close 3 posts 73 karma points
    Sep 07, 2015 @ 15:29
    Michael Close
    0

    Managed to get it with this query. Probably not the most elegant solution, but seems to work.

    $current/ancestor-or-self::[BlogPostsFolder]/child::[BlogAuthorPage]

  • Chriztian Steinmeier 2733 posts 8352 karma points MVP 5x admin c-trib
    Sep 18, 2015 @ 20:27
    Chriztian Steinmeier
    0

    Hi Michael,

    Just to make sure anyone trying to copy/paste the XPath gets it correct, here's an optimised version:

    $currentPage/ancestor-or-self::BlogPostsFolder/BlogAuthorPage
    

    (Yours were missing the asterisks in front of the predicate square-brackets - but they're not really necessary when you know the exact aliases)

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft