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.
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 ? :)
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:
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).
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? :)
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?
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.
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 ? :)
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:
-Tom
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.
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 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
OMG its working!
Once again this fabulous forum and community shows it worth! Thank to both of you!
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).
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? :)
Hmm...not sure if it will work, but you can try using the preceding-sibling axis, maybe something like:
-Tom
is working on a reply...