Copied to clipboard

Flag this post as spam?

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


  • Kevin Coster 83 posts 120 karma points
    May 21, 2014 @ 09:39
    Kevin Coster
    0

    A-Z pointing to Parent Node

    Hi All I have been looking for some code that will list A-Z content on my site have found the following which displays everything I need but want it to point to a specific Content Item and list child items not everything... But struggling to see how or where I can do that with the following XSLT

    <xsl:param name="currentPage" />
    
    <xsl:template match="/">
        <xsl:variable name="letters" select="umbraco.library:Split('A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z', ',')" />
    
        <xsl:apply-templates select="$letters" mode="list" />
    </xsl:template>
    
    
    <xsl:template match="value" mode="index">
        <li>
            <a href="#{text()}">
                <xsl:value-of select="text()"/>
            </a>
        </li>
    </xsl:template>
    
    <xsl:template match="values" mode="list">
        <div class="wrapper">
            <xsl:apply-templates select="value" mode="list" />
        </div>
    </xsl:template>
    
    <xsl:template match="value" mode="list">
        <xsl:variable name="letter" select="text()" />
        <xsl:for-each select="$currentPage/@*[1]">
            <xsl:if test="key('document-starts-with', $letter)">
                <div id="{$letter}">
                    <h2>
                        <xsl:value-of select="$letter"/>
                    </h2>
                    <ul>
                        <xsl:apply-templates select="key('document-starts-with', $letter)" mode="list" />
                    </ul>
                </div>
            </xsl:if>
        </xsl:for-each>
    </xsl:template>
    
    <xsl:template match="*[@isDoc]" mode="list">
        <li>
            <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:value-of select="@nodeName"/>
            </a>
        </li>
    </xsl:template>
    

Please Sign in or register to post replies

Write your reply to:

Draft