I don't think that would work in my scenario, as I am using the same template for multiple sections on the website. For example the news, case studies etc. But I am after a small thing changing in one of the sections (hiding something with CSS). Is it possible to do such a thing dynamically with XSLT?
Create a class based on top level section?
On the site I'm developing I'd like to put a class on the <body> that is the top level section.
For example, If my URL structure is 'http://www.example.com/top-level/second-level/current-page' I'd like to have <body class="top-level">
How would I go about doing so?
Thanks!
Sorry, that link should of been
I tried to edit the original post but I got an XSLT error :)
Hey,
You can use the following in your master template
<body<asp:ContentPlaceHolder Id="bodyClass" runat="server"/>>
Then in your child templates you can put:
<asp:content ContentPlaceHolderId="bodyClass" runat="server"> class="top-level"</asp:content>
Rich
Hi, Thanks for you response.
I don't think that would work in my scenario, as I am using the same template for multiple sections on the website. For example the news, case studies etc. But I am after a small thing changing in one of the sections (hiding something with CSS). Is it possible to do such a thing dynamically with XSLT?
That's an evil hack Rich :-)
I answered a similar question (body ID instead) here: http://our.umbraco.org/forum/developers/xslt/12017-Body-ID-selector-based-on-ancestor
/Chriztian
HI Chriztian,
That is what I was after, thank you very much!
One question though, as my level 2 pages can be two words, is it possible to hyphenate them? And maybe also make it lowercase?
Thanks!
Hi Probocop,
Sure thing - you could use the @urlName attribute instead of @nodeName, which is always lowercased and properly escaped.
/Chriztian
Perfect, thank you very much :-)
is working on a reply...