Copied to clipboard

Flag this post as spam?

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


  • chandra 3 posts 23 karma points
    Nov 29, 2010 @ 21:24
    chandra
    0

    xslt collections

    I need an xslt for a collection control that produces the below:

    <ul>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    </ul>

    <ul>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    <li>{quicklink}</li>

    </ul>

     

    The key here is to have a count on the items.  After the 7th item, it needs to start a new list.

     

    Can anybody help with these one..please and Thanks in advance

  • Kim Andersen 1447 posts 2197 karma points MVP
    Nov 29, 2010 @ 21:59
    Kim Andersen
    0

    Hi

    I don't know how you iterate through your items, but let's say that you use a for-each and runs through some childnodes from the current page like this:

    <xsl:for-each select="$currentPage/*[@isDoc]">
    something here
    </xsl:for-each>

    This might not be the most beautiful solution, but I'm pretty sure it works. Try this:

    <xsl:variable name="mod" select="number(7)"></xsl:variable>
    <xsl:for-each select="$currentPage/*[@isDoc]">
    <xsl:if test="position() mod $mod = '1'">
    <xsl:text disable-output-escaping="yes"><![CDATA[<ul>]]></xsl:text>
    </xsl:if>
    <li>
    <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
    </li>
    <xsl:if test="position() mod $mod = '0' or position()=last()">
    <xsl:text disable-output-escaping="yes"><![CDATA[</ul>]]></xsl:text>
    </xsl:if>
    </xsl:for-each>

    Then $mod variable contains the number of items that you want to show before starting a new list. As I said before it's probably not the most perfect solution, but give it a shot and let me know if it works :)

    /Kim A

  • chandra 3 posts 23 karma points
    Nov 29, 2010 @ 22:03
    chandra
    0

    Thanks kim thanks a lot.......I will give a shot and let u know......Thanks kim......

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies