Hi Everyone, It's been a while since I have had to post but this one really is because I am struggling to get my head around the new XSLT Schema.
I am running my site in XSLT Legacy mode via the setting in /config/umbracoSettings.config.
1) Does this mean that the new schema will not work at all?
2) I have seen some nice code examples for doing simple things but when I try to test these I don't seem to get a result that is expected for example:
current() [string(./umbracoNaviHide) != '1']/@nodeName or current() [not(umbracoNaviHide) = 1]/@nodeName
- both will happily return an node that has UmbracoNaviHide turned on which is not what I would expect. The old way of doing this was to do, this would work and stop the navigation item not being shown:
1) If you're running the legacy schema you should use the old way of fetching values off course? So yes, legacy won't work with the new syntax.
2) I guess you should be using the old way of doing it, since you're using the legacy schema
3) You are pretty close. I think that it will actually work, but it's a good idea to check if it's a document you're fetching from. So it should look like this
I have turned off the legacy schema, but I am still having trouble making sense of the new way of writing XSLT. I have used the same tests above as in #2 above and I am still not being able to work a true/false statement from:
I know that the above statement will return a node name, but surely the above should only return the node name if the property is 'false' as in not 1 like above?
Once I have a grasp of the little bits I will be able to battle through as my XSLT library isn't too bad, just that I am having a few stumbling blocks with the code not returning what I would expect :(
Hi Tom, What you are saying makes sense. I have tried to evaulate this but still It is selecting the node which has umbracoNaviHide set to 1. which still makes me think I haven't quite got the syntax/implementation right. I think I am going to hit the drawing board now and start to write a load of expressions to work out what I should expect. At the moment what I write and what I get back are completely different!
- though, I'm hard pressed coming up with a scenario where current() would at all be needed in the beginning of an expression, so you should also be able to say:
I want to thank you and everyone else for their time. I have been able to get my navigation working and have gone back and I am now updating a lot of the old XSLT. The new schema is very nice once you get your head around it. I like the use of the axes to perform the conditions.
One of the issues I was having was that when you switch to the new schema it looks as though you need to republish the entire site so that the DB is updated?
Republishing makes perfect sense - you're changing how every single node in the tree "looks", so the disk version ("umbraco.config") as well as the in-memory version needs to be rebuilt.
New XSLT Schema - driving me up the wall!
Hi Everyone, It's been a while since I have had to post but this one really is because I am struggling to get my head around the new XSLT Schema.
I am running my site in XSLT Legacy mode via the setting in /config/umbracoSettings.config.
1) Does this mean that the new schema will not work at all?
2) I have seen some nice code examples for doing simple things but when I try to test these I don't seem to get a result that is expected for example:
- both will happily return an node that has UmbracoNaviHide turned on which is not what I would expect. The old way of doing this was to do, this would work and stop the navigation item not being shown:
3) Whats the best way to replace:
I would expect something on the lines of this below?
Thanks for the help.
Tim
Hi Tim
1) If you're running the legacy schema you should use the old way of fetching values off course? So yes, legacy won't work with the new syntax.
2) I guess you should be using the old way of doing it, since you're using the legacy schema
3) You are pretty close. I think that it will actually work, but it's a good idea to check if it's a document you're fetching from. So it should look like this
Hope this helps a bit? :-)
/Jan
Hi Jan,
Thanks for explaining a few things.
I have turned off the legacy schema, but I am still having trouble making sense of the new way of writing XSLT. I have used the same tests above as in #2 above and I am still not being able to work a true/false statement from:
I know that the above statement will return a node name, but surely the above should only return the node name if the property is 'false' as in not 1 like above?
Once I have a grasp of the little bits I will be able to battle through as my XSLT library isn't too bad, just that I am having a few stumbling blocks with the code not returning what I would expect :(
Thanks,
Tim
I might be missing something as I've never used the not() function, but wouldn't it be: not(umbracoNaviHide = 1) or just not(umbracoNaviHide)?
I've always used string(umbracoNaviHide) != '1'
Hi Tom, What you are saying makes sense. I have tried to evaulate this but still It is selecting the node which has umbracoNaviHide set to 1. which still makes me think I haven't quite got the syntax/implementation right. I think I am going to hit the drawing board now and start to write a load of expressions to work out what I should expect. At the moment what I write and what I get back are completely different!
Hi Powellze,
With regards to umbracoNaviHide, this is how it's used with the not() function to look:
As for #3: The "New Schema" translation reads:
- though, I'm hard pressed coming up with a scenario where current() would at all be needed in the beginning of an expression, so you should also be able to say:
/Chriztian
Hi Chriztian,
I want to thank you and everyone else for their time. I have been able to get my navigation working and have gone back and I am now updating a lot of the old XSLT. The new schema is very nice once you get your head around it. I like the use of the axes to perform the conditions.
One of the issues I was having was that when you switch to the new schema it looks as though you need to republish the entire site so that the DB is updated?
Thanks Tim
Hi Tim,
You're welcome!
Republishing makes perfect sense - you're changing how every single node in the tree "looks", so the disk version ("umbraco.config") as well as the in-memory version needs to be rebuilt.
/Chriztian
is working on a reply...