I'm having some trouble getting the right level for a random image xslt.
I have a simple top navigation with a level 1 "home" and all other links level 2. The masterpage has a macro for setting a random image banner which i currently reduced to just writing the $currentPage/@level. Annoyingly, it shows level 3 on half the pages while they are obviously level 2. These pages are all direct childnodes of homepage and i checked the umbraco.config to make sure their level attribute was 2.
If you're indeed writing just $currentPage/@level out to the page and it comes out as "3" for nodes you know to be at level 2, then you're data is corrupt or out of sync in some way. To double check either use the XML Dump package to check the actual XML (i.e. not the disk version in umbraco.config) OR write the entire $currentPage XML in a <textarea> or <xmp> tag on the page, to check the level attributes.
By using your method of writing the raw currentpage xml to a textarea i found out those pages were indeed level 3.
When copying the pages for backup we discovered there was a redirect set to the pages themselves, deleting that redirect fixed it. No idea how it got set though. Hm, the client has access..
currentpage level problem
Hi all,
My first post here!
(umbraco v 4.0.3)
I'm having some trouble getting the right level for a random image xslt.
I have a simple top navigation with a level 1 "home" and all other links level 2. The masterpage has a macro for setting a random image banner which i currently reduced to just writing the $currentPage/@level. Annoyingly, it shows level 3 on half the pages while they are obviously level 2. These pages are all direct childnodes of homepage and i checked the umbraco.config to make sure their level attribute was 2.
I feel like i am missing something obvious.
All answers are much appreciated!
Kind regards,
Harm-Jan
Hi Ham-Jan,
Check out this page:
http://our.umbraco.org/wiki/reference/xslt/xpath-axes-and-their-shortcuts
:-)
I read the page but i can't find the solution yet.
I think my understanding of nodes and xpath is allright, but maybe i'm just not seeing something here.
When writing the pageName i get the correct name, but the level is wrong.
Hi Harm-Jan
Could you maybe show us an example of your XSLT code?
Hi Harm-Jan,
If you're indeed writing just $currentPage/@level out to the page and it comes out as "3" for nodes you know to be at level 2, then you're data is corrupt or out of sync in some way. To double check either use the XML Dump package to check the actual XML (i.e. not the disk version in umbraco.config) OR write the entire $currentPage XML in a <textarea> or <xmp> tag on the page, to check the level attributes.
/Chriztian
Thanks Chriztian!
By using your method of writing the raw currentpage xml to a textarea i found out those pages were indeed level 3.
When copying the pages for backup we discovered there was a redirect set to the pages themselves, deleting that redirect fixed it. No idea how it got set though. Hm, the client has access..
Thanks again for your help.
is working on a reply...