Copied to clipboard

Flag this post as spam?

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


  • Tim Melis 22 posts 43 karma points
    Apr 04, 2011 @ 00:07
    Tim Melis
    0

    Level 0 navigation

    Hi,

    In one of the video's is shown how to create a multi-langual website. I noticed that on level 0 multiple pages where created for each language. I've also added some pages on level 0 and would like to create a navigation for each languages. The names are "NL", "UK" and "FR". These are also the names I would like to use in the naviagtion.

    I've tried several solutions I found on this forum but none of them seem to work. My Macro currently looks like this...

     

    <xsl:for-each select="$currentPage/../node">
      
        <td class="MainTopTableLang"><xsl:value-of select="@nodeName"/></td>
        <td><img src="./Images/lang_sepa.gif"  class="MainTopImgLang"/></td>
      
    </xsl:for-each>

     

    Does anyone have a solution. Thanks

     

    Tim

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Apr 04, 2011 @ 08:25
    Kim Andersen
    1

    Hi Tim

    You want to create a navigation for all the top level nodes?

    If that's the case try this:

    <xsl:variable name="root" select="$currentPage/ancestor-or-self::root" />
    <xsl:for-each select="$root/*[@isDoc]">
       ...do your stuff here...
    </xsl:for-each>

    /Kim Andersen

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 04, 2011 @ 09:19
    Jan Skovgaard
    1

    Hi Tim

    Please notice that the example Kim has provided is using the new XML schema. So if you're using the old schema, which it seems like from the code you posted above you will need to modify the syntax a bit. Concept is the same.

    Maybe you can talk Kim into showing the same example based on the old syntax? ;-)

    /Jan

  • Kim Andersen 1447 posts 2196 karma points MVP
    Apr 04, 2011 @ 12:31
    Kim Andersen
    0

    Yeah, okay if you are using the legacy XML schema you should do something like this instead:

    <xsl:variable name="root" select="$currentPage/ancestor-or-self::root" />
    <xsl:for-each select="$root/node">
       ...do your stuff here...
    </xsl:for-each>

    /Kim A

  • Tim Melis 22 posts 43 karma points
    Apr 04, 2011 @ 16:53
    Tim Melis
    0

     

    Hi Kim and Jan,

    I've tried both your solutions but no luck. Now, A error is thrown "The variable of parameter currentPage is not defined or out of scope"

    <xsl:output method="xml" omit-xml-declaration="yes" />
    <xsl:param name="currentPage"/>
    <xsl:template match="/">

    <xsl:variable name="root" select="$currenPage/ancestor-or-self::root" />
    <xsl:for-each select="$root/*[@isDoc]">

        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
        </a>

    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

    The same error is thrown when trying to use the second code.  

    Any help would be great

    Kind regards

    Tim

     


  • Gordon Saxby 1444 posts 1855 karma points
    Apr 04, 2011 @ 17:18
    Gordon Saxby
    0

    If you copied the code from the post(s) above, you will probably have a spelling mistake - $currenPage should be $currentPage ... note the "t" ;-)

     

  • Pasang Tamang 258 posts 458 karma points
    Apr 04, 2011 @ 17:22
    Pasang Tamang
    0

    Your code should work Tim. Only the difference I found in your code is instead of using currentPage, you have used currenPage along with root variable. Your code should be like this

    <xsl:output method="xml" omit-xml-declaration="yes" />
    <xsl:param name="currentPage"/>
    <xsl:template match="/">
    <xsl:variable name="root" select="$currentPage/ancestor-or-self::root" />
    <xsl:for-each select="$root/*[@isDoc]">
        <href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
        </a>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

    Thanks

    Pnima

  • Tim Melis 22 posts 43 karma points
    Apr 04, 2011 @ 20:01
    Tim Melis
    0

    Hi everyone,

    It was indeed a spelling mistake...

    Thanks for all your help.

    Kind regards

    Tim

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    Apr 04, 2011 @ 20:23
    Kim Andersen
    1

    Ahh sorry for the confusion Tim. That was a typo of course - I've fixed it in my snippets above now :) But perfect that you got it working.

    /Kim Andersen

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 05, 2011 @ 22:10
    Jan Skovgaard
    0

    Wow, I really should have caught that one when I replied - but good to see that others are not blind :-)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft