In the Multi-Node tree Picker, can you deactivate all items that have children?
Love the picker. I have a tree where I only want the bottom level nodes to be clickable. (i.e. nodes that don't have children of type 'Category'). Can you do this with XPath Filter?
I did a test on the following, which picked all Document nodes under the current page which are documents didn't have children which are named Category
$currentPage/*[@isDoc and not(* [name() = 'Category'])]
It seemed to work correctly. You can also use the ancestor axis if you want things above the current page. I'm not sure if you are already in another loop, so I don't know if the $currentPage is necessary for you. If you are in another loop using current() may help.
$currentPage/*[@isDoc and name() = 'Category' and not(*[@isDoc])]
This is all Documents which have a name of Category but don't have any children which are documents. That last is important, as data elements are children of your documents, so if you leave the last [@isDoc] off it will likely return an empty set.
Now I'm wondering if we're running into an issue with the node picker.
/*[@isDoc and name() = 'Category' and (*[@isDoc]) ] - disabled everything
/*[@isDoc and name() = 'Category' and not (*[@isDoc]) ] - had all of the categories enabled including ones that had childen.
I'm wondering if the active/deactive works by parent item. If parent is inactive, all children are inactive. If parent is active, then children can be deactive...depending on the rules.
Hmm...i'll have to play around some more than. In this case, they are not necessarily at the same level. I'd like Users to be able to add items to the bottom most category.
Ie:
- category 1
----category 2
-------category 3
-------category 4
----category 5
----category 6
In this case, the only categories that should be selectable are 3, 4, 5 & 6.
The next release (which might be in a month or so... v2.1) will contain the feature to select a start node by XPath and an option to do this from the current node... this might work for you in this circumstance.
Sorry, i double posted before reading your last one :(
Seems that you have a very particular circumstance. Unfortunately i don't see way to make this work. The only way to do so would be to add a feature so that the XPath statement rendered against a node is run against the node in the context of the entire XML tree. The reason why this is not possible now is because MNTP supports unpublished content and since unpublished content does not have an XML placeholder inside of a tree, you can run XPath with axis operators (i.e. ::descendents). In your case you'd want to run an XPath statement something like this to match all nodes that are 'leaf' nodes with no children:
/*[@isDoc and name()='Category' and count(descendant::*[@isDoc]) = 0]
But again, the above will not work because at the time of running the XPath statement, it is run against a single node, not in the context of a tree. Changing the XPath statement to run in the context of the entire tree would require yet another option for MNTP to disallow unpublished content, then another option to allow XPath in the context of a tree. Unless you can get some votes up on this and more people would actually want this, then i think it might have to be left to creating a custom data type for this specific purpose.
Hi, I don't think my problem is as hard as Chads. But I'm trying to find a way of writing my Xpath so it will work with my multilingual site. Is it possible to do this today or do I also have to wait for uC v2.1?
In the Multi-Node tree Picker, can you deactivate all items that have children?
Love the picker. I have a tree where I only want the bottom level nodes to be clickable. (i.e. nodes that don't have children of type 'Category'). Can you do this with XPath Filter?
My current filter is: /*[name()='Category']
Thanks,
C
I'm doing this from the top of my head, but did you try
I think this is what you are asking. Or simply
if you don't care what the node names are below it.
Hmm....not quite.
I tried this: /*[name()='Category' and not(*[name()='Category'])]
Basically, I want to only display Categories that don't have any children. This didn't seem to change anything from my initial filter.
-C
Chad,
I did a test on the following, which picked all Document nodes under the current page which are documents didn't have children which are named Category
$currentPage/*[@isDoc and not(* [name() = 'Category'])]
It seemed to work correctly. You can also use the ancestor axis if you want things above the current page. I'm not sure if you are already in another loop, so I don't know if the $currentPage is necessary for you. If you are in another loop using current() may help.
That looks correct to me, but I'm trying to put this into an XPath Filter in the multi-node tree picker. Still not working for me.
-C
Closer to what you asked is the following:
$currentPage/*[@isDoc and name() = 'Category' and not(*[@isDoc])]
This is all Documents which have a name of Category but don't have any children which are documents. That last is important, as data elements are children of your documents, so if you leave the last [@isDoc] off it will likely return an empty set.
Now I'm wondering if we're running into an issue with the node picker.
/*[@isDoc and name() = 'Category' and (*[@isDoc]) ] - disabled everything
/*[@isDoc and name() = 'Category' and not (*[@isDoc]) ] - had all of the categories enabled including ones that had childen.
I'm wondering if the active/deactive works by parent item. If parent is inactive, all children are inactive. If parent is active, then children can be deactive...depending on the rules.
No, active/deactive is based on an individual node basis. The XPath statement is used to match against each node rendered regardless of hierarchy.
You might be able to use the @level attribute of the node to activate/deactivate children if they are on specific levels
Hmm...i'll have to play around some more than. In this case, they are not necessarily at the same level. I'd like Users to be able to add items to the bottom most category.
Ie:
- category 1
----category 2
-------category 3
-------category 4
----category 5
----category 6
In this case, the only categories that should be selectable are 3, 4, 5 & 6.
-C
The next release (which might be in a month or so... v2.1) will contain the feature to select a start node by XPath and an option to do this from the current node... this might work for you in this circumstance.
Sorry, i double posted before reading your last one :(
Seems that you have a very particular circumstance. Unfortunately i don't see way to make this work. The only way to do so would be to add a feature so that the XPath statement rendered against a node is run against the node in the context of the entire XML tree. The reason why this is not possible now is because MNTP supports unpublished content and since unpublished content does not have an XML placeholder inside of a tree, you can run XPath with axis operators (i.e. ::descendents). In your case you'd want to run an XPath statement something like this to match all nodes that are 'leaf' nodes with no children:
/*[@isDoc and name()='Category' and count(descendant::*[@isDoc]) = 0]
But again, the above will not work because at the time of running the XPath statement, it is run against a single node, not in the context of a tree. Changing the XPath statement to run in the context of the entire tree would require yet another option for MNTP to disallow unpublished content, then another option to allow XPath in the context of a tree. Unless you can get some votes up on this and more people would actually want this, then i think it might have to be left to creating a custom data type for this specific purpose.
Thanks for the response. I had a feeling that would be the answer, but it's nice to know definitively that it can't be done and why.
Back to the drawing board :-)
-C
Hi,
I don't think my problem is as hard as Chads. But I'm trying to find a way of writing my Xpath so it will work with my multilingual site. Is it possible to do this today or do I also have to wait for uC v2.1?
is working on a reply...