Sorry that was the wrong statement (I'm going round in circles with trial and error)... apologies for any confusion.
<xsl:if test="current()/node/@nodeTypeAlias != 'jobPost' and current()/node/@nodeTypeAlias!='jobForm'">
Like I say, it works when there's only jobPosts as child nodes, but if I publish a jobForm as a child also, it stops excluding the jobPosts and displays all of the child nodes.
Thanks Thomas, but unfortunately that doesn't work either.
This is driving me nuts. I think it has something to do with child nodes being a combination of both types of nodeTypeAlias but I just don't know XSLT well enough to work around it.
Perhaps I should look out for the parent type instead and not run the list if it identifies a particular type, which would jobArea in this case?
I've got a setup with nodeTypeAlias Itinerary which can have child nodes of type Notifiaction, Budget, SegmentGroup. To retrieve only SegmentGroup based on exclusion I can use the following select
//node[@nodeTypeAlias='Itinerary']/node[(@nodeTypeAlias = 'Budget' or @nodeTypeAlias = 'Notification') = 0]
This can be rewritten to list itineraries without Budget or Notification children
//node[@nodeTypeAlias='Itinerary' and node[(@nodeTypeAlias = 'Budget' or @nodeTypeAlias = 'Notification') = 0]]
Replace //node with $currentPage or other start context.
I can highly recommend testing xpath statements using sketchpad. Download from http://pgfearo.googlepages.com/downloads. Open your data\umbraco.config and enter your xpath in the middle blank textbox.
Hi Barney, I have just tested my code with our intranet and it works like a charm. Please be sure that you don't have a typo for the node types in it or a logical problem with the current() parameter (e.g. you are on a false node or something).
Herre my used code to check if there is a level2 node with one of the two doctypes:
This is working but the opposite way round, and seems to exclude everything but the node types defined in your statement.
So I can make this work as the only child nodes I want displayed are what I'm defining as normalPage types. So I added node types I wanted to see to your statement instead. Now my jobPost and jobForm types are not displayed - exactly the result I wanted so thank you very much.
I'm just curious now as to whether if there was a way of reversing it so that only the defined node types are excluded rather than included? Obviously this isn't crucial now, just interested...
Cheers again! Barney
ps - Harald thanks for your help too but that one was a bit over my head :)
Trying to exclude child nodes in menu XSLT
Hi, pulling my hair out here...
I'm using the following if statement to check current() doesn't have a nodeTypeAlias of either jobPost or jobForm before building a <ul> sub-navi.
<xsl:if test="current()/node/@nodeTypeAlias != 'jobPost' or @nodeTypeAlias != 'jobForm'">
This works if the child items are only ever one of each type, but when the child items include both types it bombs and displays the lot.
Any ideas where I'm going wrong?
Thanks,
Barney
Sorry that was the wrong statement (I'm going round in circles with trial and error)... apologies for any confusion.
<xsl:if test="current()/node/@nodeTypeAlias != 'jobPost' and current()/node/@nodeTypeAlias!='jobForm'">
Like I say, it works when there's only jobPosts as child nodes, but if I publish a jobForm as a child also, it stops excluding the jobPosts and displays all of the child nodes.
Try something like this:
hth, Thomas
Thanks Thomas, but unfortunately that doesn't work either.
This is driving me nuts. I think it has something to do with child nodes being a combination of both types of nodeTypeAlias but I just don't know XSLT well enough to work around it.
Perhaps I should look out for the parent type instead and not run the list if it identifies a particular type, which would jobArea in this case?
I've got a setup with nodeTypeAlias Itinerary which can have child nodes of type Notifiaction, Budget, SegmentGroup. To retrieve only SegmentGroup based on exclusion I can use the following select
This can be rewritten to list itineraries without Budget or Notification children
Replace //node with $currentPage or other start context.
I can highly recommend testing xpath statements using sketchpad. Download from http://pgfearo.googlepages.com/downloads. Open your data\umbraco.config and enter your xpath in the middle blank textbox.
Hi Barney, I have just tested my code with our intranet and it works like a charm. Please be sure that you don't have a typo for the node types in it or a logical problem with the current() parameter (e.g. you are on a false node or something).
Herre my used code to check if there is a level2 node with one of the two doctypes:
Cheers, Thomas
Thomas, thanks for your patient help here :)
This is working but the opposite way round, and seems to exclude everything but the node types defined in your statement.
So I can make this work as the only child nodes I want displayed are what I'm defining as normalPage types. So I added node types I wanted to see to your statement instead. Now my jobPost and jobForm types are not displayed - exactly the result I wanted so thank you very much.
I'm just curious now as to whether if there was a way of reversing it so that only the defined node types are excluded rather than included? Obviously this isn't crucial now, just interested...
Cheers again!
Barney
ps - Harald thanks for your help too but that one was a bit over my head :)
Glad I could help...
But to your question: I have made something for our intranet:
I defined a param which contains all the unwanted document types not to show in our menu:
after that I am searching for all nodes which are not from any document type defined in the param
so this is an excluding, sorry thought you were searching for an including...
Cheers, Thomas
That's really useful.. nice one. Thanks
Strangley found my old post when searching for a way to do this with the new schema.
Seems this is really easy now.
To select everything except your node type...
Barney
is working on a reply...