Copied to clipboard

Flag this post as spam?

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


  • Shwetha Shankar 21 posts 41 karma points
    May 11, 2011 @ 11:52
    Shwetha Shankar
    0

    Need to find the node type alias of page

    Hello,

    I am new to Umbraco and XSLT and your help is greatly appreciated.

    I have a requirement such that the top level menu items might contain links to external sites. In order to implement this, I have created a document type called 'External Link' (with an alias of 'externalLink'). To display the top level navigation, below is the XSL snippet I am using.

    The output is that the '<xsl:when test="string(./@nodeTypeAlias) = 'externalLink'">' is not executed even when the menu item is in fact associated with the 'External Link' doc type.

    I am aware that the @nodeTypeAlias has been replaced with $currentPage/externalLink, but I am having difficulty using this with the XSL snippet below.


    <div id="navigation">
    <ul>
    <li class="home">
    <xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id">
    <xsl:attribute name="class">active</xsl:attribute>
    </xsl:if>
    <a href="/">Home</a>
    </li>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
    <li>
    <xsl:choose>
    <xsl:when test="string(./@nodeTypeAlias) = 'externalLink'">
    <a href="{./data [@alias='externalURL']}">
    <span class="external"><xsl:value-of select="@nodeName"/></span>
    </a>
    </xsl:when>
    <xsl:otherwise>
    <xsl:if test="$currentPage/@id=current()/@id or current()/@id=$currentPage/ancestor-or-self::*/@id">
    <xsl:attribute name="class">active</xsl:attribute>
    </xsl:if>
    <a class="navigation" href="{umbraco.library:NiceUrl(@id)}">
    <span><xsl:value-of select="@nodeName"/></span>
    </a>
    </xsl:otherwise>
    </xsl:choose>
    </li>


    </xsl:for-each>
    </ul>
    </div>

    Thanks for your help.

    Regards,
    shwetha

  • skiltz 501 posts 701 karma points
    May 11, 2011 @ 12:02
    skiltz
    0
     <xsl:when test="./self::externalLink">
  • Shwetha Shankar 21 posts 41 karma points
    May 11, 2011 @ 12:28
    Shwetha Shankar
    0

    Thank you very much for the help. That worked.

    But now I am facing difficulty in displaying the value of the externalURL property that resides in the externalLink doc type.

    Here is the XSL snippet that I am using.

     

    <xsl:when test="./self::externalLink">
    <a>
    <xsl:attribute name="href">
    <xsl:value-of select="string(data [@alias='externalURL'])" />
    </xsl:attribute>
    dd<span class="external"><xsl:value-of select="@nodeName"/></span>
    </a>

    </xsl:when>

  • skiltz 501 posts 701 karma points
    May 11, 2011 @ 12:29
    skiltz
    0
    <xsl:value-of select="./externalURL" />
Please Sign in or register to post replies

Write your reply to:

Draft