Copied to clipboard

Flag this post as spam?

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


  • syn-rg 282 posts 425 karma points
    Mar 23, 2010 @ 03:28
    syn-rg
    0

    How to create an alphabetical site index

    Are there any examples of alphabetical site index's? 

  • syn-rg 282 posts 425 karma points
    May 03, 2010 @ 09:05
    syn-rg
    0

    Got this working now, for anyone who wants to use this, here's my 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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:UCommentLibrary="urn:UCommentLibrary" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets UCommentLibrary tagsLib BlogLibrary ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <div class="site_index_container">
    <ul>
    <li><a href="#A" target="_self">A</a></li>
    <li><a href="#B" target="_self">B</a></li>
    <li><a href="#C" target="_self">C</a></li>
    <li><a href="#D" target="_self">D</a></li>
    <li><a href="#E" target="_self">E</a></li>
    <li><a href="#F" target="_self">F</a></li>
    <li><a href="#G" target="_self">G</a></li>
    <li><a href="#H" target="_self">H</a></li>
    <li><a href="#I" target="_self">I</a></li>
    <li><a href="#J" target="_self">J</a></li>
    <li><a href="#K" target="_self">K</a></li>
    <li><a href="#L" target="_self">L</a></li>
    <li><a href="#M" target="_self">M</a></li>
    <li><a href="#N" target="_self">N</a></li>
    <li><a href="#O" target="_self">O</a></li>
    <li><a href="#P" target="_self">P</a></li>
    <li><a href="#Q" target="_self">Q</a></li>
    <li><a href="#R" target="_self">R</a></li>
    <li><a href="#S" target="_self">S</a></li>
    <li><a href="#T" target="_self">T</a></li>
    <li><a href="#U" target="_self">U</a></li>
    <li><a href="#V" target="_self">V</a></li>
    <li><a href="#W" target="_self">W</a></li>
    <li><a href="#X" target="_self">X</a></li>
    <li><a href="#Y" target="_self">Y</a></li>
    <li><a href="#Z" target="_self">Z</a></li>
    </ul>

    <xsl:variable name="parent" select="$currentPage/ancestor-or-self::node"/>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">A</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">B</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">C</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">D</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">E</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">F</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">G</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">H</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">I</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">J</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">K</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">L</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">M</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">N</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">O</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">P</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">Q</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">R</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">S</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">T</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">U</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">V</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">W</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">X</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">Y</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    <xsl:call-template name="alphabetTemplate">
    <xsl:with-param name="alphabet">Z</xsl:with-param>
    <xsl:with-param name="parent" select="$parent/node"/>
    </xsl:call-template>
    </div>
    </xsl:template>

    <xsl:template name="alphabetTemplate">
    <xsl:param name="alphabet"/>
    <xsl:param name="parent"/>
    <h2>
    <a>
    <xsl:attribute name="name"> <xsl:value-of select="$alphabet"/></xsl:attribute>
    <xsl:attribute name="id"> <xsl:value-of select="$alphabet"/></xsl:attribute>
    <xsl:value-of select="$alphabet"/>
    </a>
    <a href="#top" target="_top" class="top"><img src="../images/common/blank.gif" /></a>
    </h2>

    <xsl:for-each select="$parent/node [starts-with(Exslt.ExsltStrings:uppercase(@nodeName), $alphabet) and @level &lt;= 10 and (umbraco.library:IsProtected(@id, @path) = false() or umbraco.library:HasAccess(@id, @path) = true())]">
    <p><a>
    <xsl:attribute name="href"><xsl:value-of select="umbraco.library:NiceUrl(@id)" /></xsl:attribute>
    <xsl:attribute name="title"><xsl:value-of select="@nodeName"/></xsl:attribute>
    <xsl:value-of select="@nodeName"/>
    </a></p>
    </xsl:for-each>

    </xsl:template>

    </xsl:stylesheet>
  • 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