Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Craig100 1136 posts 2523 karma points c-trib
    May 26, 2011 @ 22:37
    Craig100
    0

    How to get the pageName from Master

    Newbie here, first live site....

    I have a Master Template with a few Page Templates underneath.

    In the Master <body> tag I need to add an id depending on which page is loaded.

    So I'm using: <body<umbraco:Macro Alias="BodyID" runat="server"></umbraco:Macro>> in the Master Template.

    The home page Name is "home" so the test in the xslt is what I can't work out, I've got:-

    <xsl:choose>

      <xsl:when test="current()/nodeName = 'home'">

    id="homePage"

      </xsl:when>

      <xsl:otherwise>

      </xsl:otherwise>

    </xsl:choose>

    Please help, I don't know where I'm going wrong and can't find any docs on it.

    Thanks

  • Craig100 1136 posts 2523 karma points c-trib
    May 26, 2011 @ 22:53
    Craig100
    0

    Typical, you try it for an hour, run out of ideas, ask for help and bingo, you get it working!

    It was:-

    <xsl:when test="$currentPage/@nodeName = 'Home'">

    Hope this helps someone else;)

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    May 26, 2011 @ 23:48
    Chriztian Steinmeier
    0

    Hi Craig100,

    If you want to skip creating a macro for something like this, here's a thread using "inline XSLT" to do basically the same thing:

    http://our.umbraco.org/forum/developers/xslt/12017-Body-ID-selector-based-on-ancestor#comment44495

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft