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.
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
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>
is working on a reply...