Last active
December 16, 2015 09:58
-
-
Save pretentiousgit/5416190 to your computer and use it in GitHub Desktop.
XSL to produce clean bulleted list for Sharepoint 2010 Table of Contents webpart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// HERE IS YOUR CSS | |
/* TOC webpart style */ | |
.level-section-header { | |
font-size: 14px; font-weight:bold;margin:5px; | |
} | |
.level-section-fresh{ /* .level-section is set inline in TOC pages, so .level-section-fresh is a new class added to LevelStyle.xsl VerticalBullet (custom) to bypass */ | |
margin:1px 0px 0px 15px; | |
border-style: none; | |
border-color: inherit; | |
border-width: 0; | |
vertical-align:top; | |
background-image:url("/_layouts/images/lstbulet.gif"); | |
background-repeat:no-repeat; | |
background-position:left; | |
padding-left:10px; | |
padding-right: 0px; | |
} | |
/// HERE IS YOUR XSL | |
<xsl:template name="VerticalHeader" match="Level[@LevelTemplate='VerticalHeader']"> | |
<xsl:variable name="LevelIndent" select="(number(@LevelNumber)-number(1))*number(14)+number(4)"></xsl:variable> | |
<xsl:variable name="LeafIndent" select="$LevelIndent+6"></xsl:variable> | |
<xsl:variable name="LeafIndentWithBullet" select="$LevelIndent+14"></xsl:variable> | |
<li class="level-section-header"> | |
<xsl:choose> | |
<xsl:when test='string-length(@Path) > 0'> | |
<a href="{cmswrt:EnsureIsAllowedProtocol(string(@Path))}"> | |
<xsl:value-of select="@Title"/> | |
</a> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:value-of select="@Title"/> | |
</xsl:otherwise> | |
</xsl:choose> | |
</li> | |
</xsl:template> | |
<xsl:template name="VerticalBullet" match="Level[@LevelTemplate='VerticalBullet']"> | |
<xsl:variable name="LevelIndent" select="(number(@LevelNumber)-number(1))*number(14)+number(4)"></xsl:variable> | |
<xsl:variable name="LeafIndent" select="$LevelIndent+6"></xsl:variable> | |
<xsl:variable name="LeafIndentWithBullet" select="$LevelIndent+14"></xsl:variable> | |
<li class="level-section-fresh"> | |
<xsl:choose> | |
<xsl:when test='string-length(@Path) > 0'> | |
<a href="{cmswrt:EnsureIsAllowedProtocol(string(@Path))}"> | |
<xsl:value-of select="@Title"/> | |
</a> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:value-of select="@Title"/> | |
</xsl:otherwise> | |
</xsl:choose> | |
</li> | |
</xsl:template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment