|
<?xml version="1.0" encoding="UTF-8"?> |
|
<!DOCTYPE xsl:stylesheet [ |
|
<!ENTITY nbsp " "> |
|
]> |
|
<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" |
|
exclude-result-prefixes="msxml umbraco.library"> |
|
|
|
<xsl:key name="document-starts-with" match="*[@isDoc]" use="translate(substring(@nodeName, 1, 1), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> |
|
|
|
<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="index" /> |
|
<xsl:apply-templates select="$letters" mode="list" /> |
|
</xsl:template> |
|
|
|
<xsl:template match="values" mode="index"> |
|
<ul> |
|
<xsl:apply-templates select="value" mode="index" /> |
|
</ul> |
|
</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}"> |
|
<h3> |
|
<xsl:value-of select="$letter"/> |
|
</h3> |
|
<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> |
|
|
|
</xsl:stylesheet> |
Curious if there is a way to get around the
$currentPage/@*[1]
hack - to return the context back to the Umbraco nodes. Still beautiful markup.