Copied to clipboard

Flag this post as spam?

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


  • Mahmood 28 posts 48 karma points
    May 19, 2011 @ 15:00
    Mahmood
    0

    how to get the li id in foreach loop of xsl?

     <xsl:if test="count($items) &gt; 0">
                                <ul>
                                    <xsl:for-each select="$items">
                                        <xsl:variable name="items1" select="@nodeName/ancestor-or-self::* [@isDoc and @level = 3]/* [@isDoc and string(umbracoNaviHide) != '1']" />
                                        <xsl:choose>
                                            <xsl:when test="count($items1) &gt; 0">
                                                <li id="{concat('li_',position())}" onclick="leftmenutoogle('{position()}')" class="leftmenu_arrow">
                                                 
                                                    <a href="#">
                                                        <xsl:value-of select="@nodeName" />
                                                    </a>
                                                    <div class="lmenu_level2" id="{concat('menu_',position())}" style="display: none;">
                                                        <ul>
                                                            <xsl:for-each select="$items1">
                                                                <li>

                                                           <a href="{umbraco.library:NiceUrl(@id)}?id={I want to get the li ID}">
                                                                        <xsl:value-of select="@nodeName" />
                                                                     </a>

                                                                </li>                                                           
                                                            </xsl:for-each>
                                                        </ul>
                                                    </div>
                                                </li>
                                            </xsl:when>                                      
                                        </xsl:choose>
                                    </xsl:for-each>
                                </ul>
                            </xsl:if>

     

    for example :

    if the li id is li_1

    then i want this id in

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

  • Eran Meir 401 posts 543 karma points
    May 19, 2011 @ 15:21
    Eran Meir
    0

    you need to use current()/@id

  • Mahmood 28 posts 48 karma points
    May 19, 2011 @ 16:25
    Mahmood
    0

    no its not working...

    i need <li id="{concat('li_',position())}"

    which is li_1 and li_2  if there are two parents...

    i need this  id in querystring of anchor tab. of foreach loop

    <a href="{umbraco.library:NiceUrl(@id)}?id={I want to get the li ID}">

    i want this:

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

  • Mentor Digital 19 posts 135 karma points
    May 19, 2011 @ 18:25
    Mentor Digital
    0

    Try:

     

    <xsl:if test="count($items) &gt; 0">
                                <ul>
                                    <xsl:for-each select="$items">
                                        <xsl:variable name="items1" select="@nodeName/ancestor-or-self::* [@isDoc and @level = 3]/* [@isDoc and string(umbracoNaviHide) != '1']" />
                                        <xsl:choose>
                                            <xsl:when test="count($items1) &gt; 0">

    <xsl:variable name="LIID" select="concat('li_',position())" />
                                                <li id="{$LIID}" onclick="leftmenutoogle('{position()}')" class="leftmenu_arrow">
                                                 
                                                    <a href="#">
                                                        <xsl:value-of select="@nodeName" />
                                                    </a>
                                                    <div class="lmenu_level2" id="{concat('menu_',position())}" style="display: none;">
                                                        <ul>
                                                            <xsl:for-each select="$items1">
                                                                <li>

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

                                                                </li>                                                           
                                                            </xsl:for-each>
                                                        </ul>
                                                    </div>
                                                </li>
                                            </xsl:when>                                      
                                        </xsl:choose>
                                    </xsl:for-each>
                                </ul>
                            </xsl:if>

  • Mahmood 28 posts 48 karma points
    May 20, 2011 @ 13:26
    Mahmood
    0

    Thanks Craiq...

Please Sign in or register to post replies

Write your reply to:

Draft