<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tomblog &#187; Table of Contents</title>
	<atom:link href="http://tomblog.insomniacminds.com/tag/table-of-contents/feed/" rel="self" type="application/rss+xml" />
	<link>http://tomblog.insomniacminds.com</link>
	<description>Rantings of an Insomniac Mind</description>
	<lastBuildDate>Sun, 31 Jul 2011 17:59:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SharePoint Branding Issues: Table Of Contents WebPart</title>
		<link>http://tomblog.insomniacminds.com/2007/10/12/sharepoint-branding-issues-table-of-contents-webpart/</link>
		<comments>http://tomblog.insomniacminds.com/2007/10/12/sharepoint-branding-issues-table-of-contents-webpart/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 22:22:36 +0000</pubDate>
		<dc:creator>Tombo</dc:creator>
				<category><![CDATA[Branding]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Issues]]></category>
		<category><![CDATA[Master Pages]]></category>
		<category><![CDATA[Table of Contents]]></category>
		<category><![CDATA[WebPart]]></category>

		<guid isPermaLink="false">http://tomblog.insomniacminds.com/2007/10/12/sharepoint-branding-issues-table-of-contents-webpart/</guid>
		<description><![CDATA[On one of my projects I had to customize the table of contents webpart. This webpart can list pages, lists and subsites of a specific site, and this in a custom organization and presentation. When using it on the default master page, it shows the content in different levels with some nice indentation applied to [...]]]></description>
			<content:encoded><![CDATA[<p>On one of my projects I had to customize the table of contents webpart. This webpart can list pages, lists and subsites of a specific site, and this in a custom organization and presentation. When using it on the default master page, it shows the content in different levels with some nice indentation applied to it.</p>
<p><img src="http://tomblog.insomniacminds.com/wp-content/uploads/2007/10/sbi_toc_1.png" alt="Table of Contents using default.master" /></p>
<p>But when I activated my custom master page, the indentation suddenly did not show. My first reaction was: &#8220;OK, this surely is some classic CSS problem. I&#8217;ll just set the correct class back in my custom CSS file.&#8221; However, whatever I tried, whatever CSS rule I put in, the indentation did not come back. Worse, there&#8217;s already margin applied to the elements, hard coded in the webpart. But Internet Explorer did not seem to wanna show it when using my master page. And this was only the beginning&#8230;</p>
<p>When stripping down both the default master page and my custom master page down to the bare necessities (no css files, no other controls, &#8230; nothing), the default master page still showed the indents while my master page didn&#8217;t! And to get even more confused, the other MOSS master pages do not show the margins either! This is weird.. very weird. What the hell makes the difference?</p>
<p><img src="http://tomblog.insomniacminds.com/wp-content/uploads/2007/10/sbi_toc_2.png" alt="Table of Contents using OrangeSingleLevel.master" /></p>
<p>And then it hit me. My master page and the MOSS master pages use following code, where the default.master does not:</p>
<p><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<a href="http://www.w3.org/TR/html4/loose.dtd">http://www.w3.org/TR/html4/loose.dtd</a>"&gt;</code></p>
<p>For those of you who do not know what this is, you can read all about it over <a href="http://www.w3schools.com/tags/tag_doctype.asp" title="W3Schools: DocType">here </a>. Basicly, it instructs the browser how to parse the HTML and CSS. How is this relevant, you ask? Well, as I said, the table of contents uses some inline code to display the indentation.</p>
<p>      <code>&lt;div style="margin-left:12;"&gt;</code></p>
<p>At first glance, this seems spot on, correct. Except, it isn&#8217;t. Though the default behaviour of Internet Explorer would accept this line. When using the doctype, Internet Explorer demands more precision and clarity. What kind of clarity? This kind:</p>
<p>      <code>&lt;div style="margin-left:12<strong>px</strong>;"&gt;</code></p>
<p>Yes, indeed, it&#8217;s the unit. Doctype requires correct values and units. And if those are not available, the browser will simply ignore the values. So what are the implications? All MOSS master pages and custom master pages, using this kind of doctype, will not show the identations. Talking about a bug.. <img src='http://tomblog.insomniacminds.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>The solution, of course, is adding the &#8216;px&#8217; unit to the style. Luckily, the table of contents is one of those webparts which uses XSL style sheets to format its data and makes those available in the Style Library within your SharePoint site collection. Once inside this style sheet (LevelStyle.xsl), one can easily add the px to the different styles using the margin. This creates an instant solution to the problem. If you want to apply this to your entire farm, go to your server and adjust the LevelStyle.xsl in the PublishingResources feature.</p>
<p><img src="http://tomblog.insomniacminds.com/wp-content/uploads/2007/10/sbi_toc_3.png" alt="Fixed Table of Contents using OrangeSingleLevel.master" /></p>
<p>For the aftermath: this is sort of a silly problem. It could have been easily prevented. Nevertheless, these kind of problems are very hard to track down. My fear is this is not an isolated case and there could be more of those little &#8216;bugs&#8217; within SharePoint, due to inconsistent use of CSS. This is quite a shame, I think, for such a rich product. <img src='http://tomblog.insomniacminds.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' />   But anyway, what have we learned today? Always set your units in CSS! <img src='http://tomblog.insomniacminds.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  See ya next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://tomblog.insomniacminds.com/2007/10/12/sharepoint-branding-issues-table-of-contents-webpart/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>

