Copied to clipboard

Flag this post as spam?

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


  • PRK 47 posts 119 karma points
    Nov 16, 2010 @ 14:21
    PRK
    0

    Convert to new schema

    Hello everybody,

    I`d like to convert a old Navigation with Submenus to the new schema.

    But it doesn`t work fine.I do not know what I'm doing wrong.

    Could someone translate the code?

    This is the old schema code:

     

    <?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"
        exclude-result-prefixes="msxml umbraco.library">

        <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="documentTypeAlias" select="string('Textseite')"/>-->
        <xsl:template match="/">
            <ul>
                <xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::node [@level=1]" />
                <li>
                    <xsl:if test="$rootNode/@id = $currentPage/@id">
                        <xsl:attribute name="class">
                            <xsl:text>visited</xsl:text>
                        </xsl:attribute>
                    </xsl:if>
                   
                    <a href="{umbraco.library:NiceUrl($rootNode/@id)}">
                        <xsl:value-of select="$rootNode/@nodeName" />
                    </a>
                </li>
            <xsl:for-each select="$currentPage/ancestor-or-self::node/node [@level = 2 and string(data[@alias='umbracoNaviHide']) != '1']">
                        <li>
                                <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
                                    <xsl:attribute name="class">
                                            <xsl:text>visited</xsl:text>
                                    </xsl:attribute>
                            </xsl:if>
                       
                            <a href="{umbraco.library:NiceUrl(@id)}">
                                    <xsl:value-of select="@nodeName" />
                            </a>
                   
                          <xsl:variable name="subItems" select="umbraco.library:GetXmlNodeById(@id)/child::node [string(data [@alias='umbracoNaviHide']) != '1']"/>
                          <xsl:if test="count($subItems)">
                            <table><tr><td>   
                        <ul>
                                      <xsl:for-each select="$subItems">
                                        <li>
                                <a href="{umbraco.library:NiceUrl(@id)}">
                                              <xsl:value-of select="@nodeName"/>
                                </a>
                                     </li>
                            </xsl:for-each>
                        </ul>
                    </td></tr></table>   
                        </xsl:if>   
                        </li>
            </xsl:for-each>
            </ul>
        </xsl:template>
    </xsl:stylesheet>

     

    Please help! Thanks a lot!!!

     

    PRK

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Nov 16, 2010 @ 14:23
    Sebastiaan Janssen
    0

    Have you had a look at the conversion tools out there? Might work just fine out of the box!

  • PRK 47 posts 119 karma points
    Nov 16, 2010 @ 14:29
    PRK
    0

    Yes, I`ve used this. But it doesn`t work fine. 

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Nov 16, 2010 @ 15:05
    Sebastiaan Janssen
    0

    So, when you try them, what exactly goes wrong? Might just need a few little tweaks to fix them.

  • PRK 47 posts 119 karma points
    Nov 16, 2010 @ 15:14
    PRK
    0

    I would like to update www.Treetec.at .

    The test site is on treetec.kogler-software.at

    But it only shows me Home.

     

    This is the translated 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"
    exclude-result-prefixes="msxml umbraco.library">

    <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="documentTypeAlias" select="string('Textseite')"/>-->
    <xsl:template match="/">
    <ul>
    <xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::* [@isDoc][@level=1]" />
    <li>
    <xsl:if test="$rootNode/@id = $currentPage/@id">
    <xsl:attribute name="class">
    <xsl:text>visited</xsl:text>
    </xsl:attribute>
    </xsl:if>

    <a href="{umbraco.library:NiceUrl($rootNode/@id)}">
    <xsl:value-of select="$rootNode/@nodeName" />
    </a>
    </li>
    <xsl:for-each select="$currentPage/ancestor-or-self::node/* [@isDoc][@level = 2 and string(umbracoNaviHide) != '1']">
    <li>
    <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
    <xsl:attribute name="class">
    <xsl:text>visited</xsl:text>
    </xsl:attribute>
    </xsl:if>

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

    <xsl:variable name="subItems" select="umbraco.library:GetXmlNodeById(@id)/child::* [@isDoc][string(umbracoNaviHide) != '1']"/>
    <xsl:if test="count($subItems)">
    <table><tr><td>
    <ul>
    <xsl:for-each select="$subItems">
    <li>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/>
    </a>
    </li>
    </xsl:for-each>
    </ul>
    </td></tr></table>
    </xsl:if>
    </li>
    </xsl:for-each>
    </ul>
    </xsl:template>
    </xsl:stylesheet>

     

     

    Thank you'll take the time to my problem.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Nov 17, 2010 @ 20:37
    Sebastiaan Janssen
    0

    Sorry for the late reply! I checked your site and it looks like it is working now, did you solve the problem?

  • PRK 47 posts 119 karma points
    Nov 18, 2010 @ 09:46
    PRK
    0

    Good morning!

     

    No, the Website www.Treetec.at is still under the old scheme.

    The new page can be found at treetec.kogler-software.at .

    As you can see, The menu only shows me home. 

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Nov 18, 2010 @ 09:54
    Sebastiaan Janssen
    0

    Ah right, I'm sorry, I missed that :-)

    Well, I am not very well versed with the new schema yet, but what you can do is create a new XSLT in umbraco and choose the "Sitemap" template. That will give you most of what you need, you only need to figure out when to apply the "visited" class then, I don't really understand how that works in your current navigation.

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Nov 18, 2010 @ 10:42
    Chriztian Steinmeier
    0

    Hi PRK,

    Here's a conversion made by my favorite XSLT "converter tool" (myself, sorry :-)

    <?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"
    exclude-result-prefixes="msxml umbraco.library">
    
    <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="documentTypeAlias" select="'Textseite'"/>-->
    <xsl:template match="/">
        <ul>
            <xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::* [@isDoc][@level=1]" />
            <li>
                <xsl:if test="$rootNode/@id = $currentPage/@id">
                    <xsl:attribute name="class">
                        <xsl:text>visited</xsl:text>
                    </xsl:attribute>
                </xsl:if>
    
                <a href="{umbraco.library:NiceUrl($rootNode/@id)}">
                    <xsl:value-of select="$rootNode/@nodeName" />
                </a>
            </li>
            <xsl:for-each select="$currentPage/ancestor-or-self::/*[@isDoc][@level = 2 and not(umbracoNaviHide = 1)]">
                <li>
                    <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">
                        <xsl:attribute name="class">
                            <xsl:text>visited</xsl:text>
                        </xsl:attribute>
                    </xsl:if>
    
                    <a href="{umbraco.library:NiceUrl(@id)}">
                        <xsl:value-of select="@nodeName" />
                    </a>
    
                    <xsl:variable name="subItems" select="*[@isDoc][not(umbracoNaviHide = 1)]"/>
                        <xsl:if test="$subItems">
                            <table><tr><td>
                                <ul>
                                    <xsl:for-each select="$subItems">
                                        <li>
                                            <a href="{umbraco.library:NiceUrl(@id)}">
                                                <xsl:value-of select="@nodeName"/>
                                            </a>
                                        </li>
                                    </xsl:for-each>
                                </ul>
                            </td></tr></table>
                        </xsl:if>
                    </li>
                </xsl:for-each>
            </ul>
        </xsl:template>
    </xsl:stylesheet>

    /Chriztian

  • PRK 47 posts 119 karma points
    Nov 18, 2010 @ 11:49
    PRK
    0

    I`ve found the solution. 

    I downloaded the CWS Package and I rewrote the Navigation Code. 

    This is the code result.

     

    <?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"
      exclude-result-prefixes="msxml umbraco.library">
      
      <xsl:output method="xml" omit-xml-declaration="yes"/>
      <xsl:param name="currentPage"/>
      
      <xsl:template match="/">
      
        <!-- Root Node -->
        <xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::root" />

        <!-- Homepage -->
        <xsl:variable name="homeNode" select="$rootNode/Startseite [@isDoc]" />
        
        <ul>
          <li>
            <xsl:if test="$homeNode/@id = $currentPage/@id">
              <xsl:attribute name="class">
                <xsl:text>visited</xsl:text>
              </xsl:attribute>
            </xsl:if>
            
            <a href="{umbraco.library:NiceUrl($homeNode/@id)}">
              <xsl:value-of select="$homeNode/@nodeName" />
            </a>
          </li>
          
          <xsl:for-each select="$homeNode/* [@isDoc and @level = 2 and string(umbracoNaviHide) != '1']">
            <li>
              <xsl:if test="$currentPage/ancestor-or-self::* [@isDoc]/@id = current()/@id">
                <xsl:attribute name="class">
                  <xsl:text>visited</xsl:text>
                </xsl:attribute>
              </xsl:if>
              
              <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:value-of select="@nodeName" />
              </a>
              
              <xsl:variable name="subItems" select="umbraco.library:GetXmlNodeById(@id)/child::* [@isDoc][string(umbracoNaviHide) != '1']"/>
                <xsl:if test="count($subItems)">
                  <table><tr><td>
                    <ul>
                      <xsl:for-each select="$subItems">
                        <li>
                          <a href="{umbraco.library:NiceUrl(@id)}">
                            <xsl:value-of select="@nodeName"/>
                          </a>
                        </li>
                      </xsl:for-each>
                   </ul>
                  </td></tr></table>
                </xsl:if>
            </li>
          </xsl:for-each>
        </ul>
      </xsl:template>
    </xsl:stylesheet>

     

    Thanks to all who have dealt with my problem.

    That's why I love Umbraco.

    Thank`s!!!!

    /PRK

Please Sign in or register to post replies

Write your reply to:

Draft