Copied to clipboard

Flag this post as spam?

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


  • Emil Christiansen 66 posts 148 karma points
    Aug 09, 2011 @ 11:22
    Emil Christiansen
    0

    Using Multi-Node Tree Picker without publishing node

    Hi

    I am using an XPATH expression to navigate to a wanted start node.

    The expression is working, but i am only able to pick and see the nodes in the MNTP if the node itself is published.

    Perhaps this is a stupid quiestion, but is it in anyway possible to do this before you publish the node?

  • Lennart Stoop 304 posts 842 karma points
    Aug 09, 2011 @ 11:47
    Lennart Stoop
    1

    Hey Emil,

    If you configure the MNTP selection type as "global" you can use $ancestorOrSelf in your Xpath expression, which will then find the nearest published node to render the tree.

  • Emil Christiansen 66 posts 148 karma points
    Aug 09, 2011 @ 13:46
    Emil Christiansen
    0

    Hmmm, let me try to explain my problem a bit further with the following image (perhaps a very lame example, but...):

    Lets say i wanted to use the MNTP in the Car Setup - Wheel property. If it is on Car1, i should only be able to choose between 10" and 12", but if it is Car2 you should choose from 10", 20", 30" and 40". As i said, this is possible, but only if Car Setup nodes is published. Is there a workaround to this problem, or am I approaching this in a completely stupid way ? :)

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Aug 09, 2011 @ 14:09
    Tom Fulton
    0

    Hi Emil,

    What Lennart said should work fine.  using $ancestorOrSelf as the start node means the current page (Car Setup) doesn't need to be published, since it starts with the page's parent.

    So you could use something like this to get the start node to be "Wheel Types" under the current Car:

    $ancestorOrSelf/* [local-name() = 'CarDocTypeAlias']/WheelTypes

    -Tom

  • Emil Christiansen 66 posts 148 karma points
    Aug 09, 2011 @ 15:11
    Emil Christiansen
    0

    Hmmm...

    Ok, in backoffice - i choose my Multi Node Tree Picker Data Type which uses the uComponents: Multi-Node Tree Picker as render control.

    In the "XPath type" i choose global, is this right?

    In the "Xpath Expression" i put in: $ancestorOrSelf/* [local-name() = 'CarDocTypeAlias']/WheelTypes 

    Of course i have put in the right doc type name...

    When i go back to the Content section in backoffice, i get the following error when i choose a 'Car Setup' node: 

    Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Aug 09, 2011 @ 15:33
    Tom Fulton
    1

    What version are you using?  I think $ancestorOrSelf was added in 2.2 or one of the recent versions (maybe even a beta).

    Try using this instead:

    $parentPage/ancestor-or-self::* [local-name() = 'CarDocTypeAlias']/WheelTypes

    ($parentPage was replaced with $ancestorOrSelf in a later version).  Note it requires the parent page to be published.

    Or you can try upgrading to the latest version (still in beta though I believe)

    -Tom

  • Emil Christiansen 66 posts 148 karma points
    Aug 09, 2011 @ 15:44
    Emil Christiansen
    0

    OMG its working!

    Once again this fabulous forum and community shows it worth! Thank to both of you!

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Aug 09, 2011 @ 15:54
    Tom Fulton
    0

    Awesome!  Keep in mind when/if you upgrade to the latest version of uComponents $parentPage will stop working, so you'll need to replace with $ancestorOrSelf (assuming you didn't upgrade yet).

  • Emil Christiansen 66 posts 148 karma points
    Aug 10, 2011 @ 11:59
    Emil Christiansen
    0

    Sorry to disturb again! I am still having a bit of problems with xpath... in the following example, is it in anyway possible to use the MNTP in the "motor" node and via xpath get to the "Seats" node, when Car is not published but the Seats, Tires and Motor nodes are? I am thinking something with sibling nodes... perhaps? :)

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Aug 10, 2011 @ 13:29
    Tom Fulton
    0

    Hmm...not sure if it will work, but you can try using the preceding-sibling axis, maybe something like:

    $currentPage/preceding-sibling::Seats

    -Tom

Please Sign in or register to post replies

Write your reply to:

Draft