Copied to clipboard

Flag this post as spam?

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


  • gustav 11 posts 53 karma points
    Jan 16, 2014 @ 14:02
    gustav
    0

    Display nodename for one page.

    Hi 

    I have a problem with displaying nodename 

    Im listing. a menu starting from a specific node id. This works great, but I want to list the node id itself (1054) and have the possibility to change style of that link compared to its children,  Is it possible somehow to use a simple solution displayed below and get the node name of 1054?

        <li> <a href="{umbraco.library:NiceUrl(1054)}"></a> </li>

    BR

    Gustav 

    example of my XSLT

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>

    <xsl:stylesheet 

      version="1.0" 

      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 

    xmlns:msxml="urn:schemas-microsoft-com:xslt" 

    xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:Examine="urn:Examine" 

    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets Examine ">

     

    <xsl:output method="xml" omit-xml-declaration="yes"/>

     

    <xsl:param name="currentPage"/>

     

    <!-- update this variable on how deep your site map should be -->

    <xsl:variable name="maxLevelForSitemap" select="3"/>

     

    <xsl:template match="/">

    <div id="sitemap">

     

     

     

        <li>

          <a href="{umbraco.library:NiceUrl(1054)}"></a>

     

     

        </li>

    <xsl:call-template name="drawNodes">  

    <xsl:with-param name="parent" select="umbraco.library:GetXmlNodeById(1054) "/>

    </xsl:call-template>

    </div>

    </xsl:template>

    <xsl:template name="drawNodes">

    <xsl:param name="parent"/> 

    <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">

    <ul><xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and @level &lt;= $maxLevelForSitemap]"> 

    <li>  

    <a href="{umbraco.library:NiceUrl(@id)}">

    <xsl:value-of select="@nodeName"/></a>  

    <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1' and @level &lt;= $maxLevelForSitemap]) &gt; 0">   

    <xsl:call-template name="drawNodes">    

    <xsl:with-param name="parent" select="."/>    

    </xsl:call-template>  

    </xsl:if> 

    </li>

    </xsl:for-each>

    </ul>

    </xsl:if>

    </xsl:template>

    </xsl:stylesheet>

  • gustav 11 posts 53 karma points
    Jan 16, 2014 @ 14:24
    gustav
    0

    Hi 

    Example below is not working either...

     

        <li>

          <a href="{umbraco.library:NiceUrl(1054)}">

            <xsl:value-of select="@nodeName"/>

          </a>

        </li>

     

    gustav 

     

  • Dan 1288 posts 3921 karma points c-trib
    Jan 16, 2014 @ 14:31
    Dan
    0

    Hi Gustav,

    I'm not totally following what you're trying to do, but to get the node properties (including node name) from a node id you can use the umbraco.library:GetXmlNodeById extension method, something like this:

    <xsl:value-of select="umbraco.library:GetXmlNodeById(1054)/@nodeName" />
    

    Does this help?

  • gustav 11 posts 53 karma points
    Jan 16, 2014 @ 14:54
    gustav
    0

    Hi Dan

    Tanks! I worked perfectly! 

    /Gustav 

Please Sign in or register to post replies

Write your reply to:

Draft