Copied to clipboard

Flag this post as spam?

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


  • ahmad awada 3 posts 23 karma points
    Nov 10, 2010 @ 14:10
    ahmad awada
    0

    access document properties

    Hi all,

    i am new to umbraco and xslt

    i am trying to generate two level menu using xslt. for the first level menu i need to get the value of document property called MenuClassName. but it doesn't work, this is the code.

    <xsl:param name="currentPage"/>

    <!-- Input the documenttype you want here -->
    <xsl:variable name="level" select="1"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul class="menu">
    <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']">
     <li>
      <a href="{umbraco.library:NiceUrl(@id)}">
      <xsl:value-of select="@nodeName"/>
      <xsl:value-of select="current()[string(data [@alias='MenuClassItem'])]"/>
      </a>
      <ul class="acitem">
      <xsl:for-each select="current()/node [string(data [@alias='umbracoNaviHide']) != '1']">
        <li>
       <a href="{umbraco.library:NiceUrl(@id)}">
       <xsl:value-of select="@nodeName"/></a>
        </li>
      </xsl:for-each>
      </ul>
     </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

     

  • Powellze 38 posts 73 karma points
    Nov 10, 2010 @ 14:26
    Powellze
    0

    Ahmed, what version of Umbraco are you using? Do you have the legacy schema turn on or off?

     

    If you are using the new schema you can do a for each such as this:

    <xsl:for-each select="$currentPage/ancestor-or-self::* 
    [@level=$level]/* [not(umbracoNaviHide=1)]">

    and then use:

    <xsl:value-of select="MenuClassItem" />

    You dont need to use current() and the data alias etc parts in the new schema

     

    If your using the old schema i will add another post.

     

    What is the current output you are getting from your existing XSLT?

  • ahmad awada 3 posts 23 karma points
    Nov 10, 2010 @ 15:42
    ahmad awada
    0

    hi, thanks for your replay.

    my umbraco version was 4.0.3 now i upgraded into 4.5.2 and i left the legacy schema  false

    and i created the xslt file again and modified it and now it's working.  

Please Sign in or register to post replies

Write your reply to:

Draft