first off, here is the post that goes with this one. Sharepoint 2010 Discussion Board Thread.xsl
Ok, I am trying to modify the ootb sharepoint discussion board xslt, with divs with id's so I can easily format it the way our designer wants them to look. I am getting the error
An item of type 'Attribute' cannot be constructed within a node of type 'Root'.
Here is the code:
<xsl:value-of select="$thisNode/@Editor.span" disable-output-escaping="yes"/>
</div>
</xsl:template>
<xsl:template name="FieldRef_Thread_BodyAndMore_Computed_Thread" match="FieldRef[@Name='BodyAndMore']" mode="Computed_body" ddwrt:dvt_mode="body">
<xsl:param name="thisNode" select="."/>
<xsl:param name="Position" select="1"/>
<xsl:if test="$Position = 1">
<input type="hidden" name="CAML_Expand" value="{$CAML_Expand}"/>
<input type="hidden" name="CAML_ShowOriginalEmailBody" value="{$CAML_ShowOriginalEmailBody}"/>
</xsl:if>
<xsl:variable name="isRootPost">
<xsl:call-template name="IsRootPost">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
</xsl:variable>
<xsl:if test="$isRootPost='TRUE'">
<div style="padding-bottom: 4px;">
<b>
<xsl:choose>
<xsl:when test="$thisNode/@FSObjType='1'">
<xsl:value-of select="$thisNode/@Title"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$thisNode/@DiscussionTitleLookup"/>
</xsl:otherwise>
</xsl:choose>
</b>
</div>
</xsl:if>
<xsl:variable name="BodyPositioningClass">
<xsl:if test="$isRootPost='TRUE'">ms-disc-root-body</xsl:if>
</xsl:variable>
<div class="{$BodyPositioningClass}">
<xsl:choose>
<xsl:when test="$thisNode/@Body=''">
<xsl:value-of select="$thisNode/../@resource.wss.NoText"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="WasExpanded">
<xsl:call-template name="BodyWasExpanded">
<xsl:with-param name="thisNode" select ="$thisNode"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$WasExpanded='TRUE'">
<!-- fullbody -->
<xsl:call-template name="FullBody">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
<xsl:variable name="CorrectBody">
<xsl:call-template name="CorrectBodyToShow">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="contains($CorrectBody, 'TrimmedBody')">
<!--brent edit-->
<div id="trimmedBody">
<xsl:call-template name="LessLink">
<xsl:with-param name="thisNode" select ="$thisNode"/>
</xsl:call-template>
<xsl:call-template name="ToggleQuotedText">
<xsl:with-param name="thisNode" select ="$thisNode"/>
</xsl:call-template>
</div>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="LessLink">
<xsl:with-param name="thisNode" select ="$thisNode"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="TextWasExpanded">
<xsl:call-template name="QuotedTextWasExpanded">
<xsl:with-param name="thisNode" select ="$thisNode"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$TextWasExpanded='TRUE'">
<xsl:call-template name="FullBody">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
<xsl:call-template name="ToggleQuotedText">
<xsl:with-param name="thisNode" select ="$thisNode"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="LimitedBody">
<xsl:with-param name="thisNode" select ="$thisNode"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<xsl:template name="FieldRef_Thread_Threading_Computed_Thread" match="FieldRef[@Name='Threading']" mode="Computed_body" ddwrt:dvt_mode="body">
<xsl:param name="thisNode" select="."/>
<xsl:param name="Position" select="1"/>
<!--Brent Edit-->
<xsl:variable name="ID">
<xsl:call-template name="ResolveId">
<xsl:with-param name="thisNode" select="$thisNode" />
</xsl:call-template>
</xsl:variable>
<div id="IndentTemplate{$ID}{generate-id()}">
<xsl:call-template name="Indentation">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
<xsl:call-template name="FieldRef_Thread_BodyAndMore_Computed_Thread">
<xsl:with-param name="thisNode" select="$thisNode"/>
<xsl:with-param name="Position" select="$Position"/>
</xsl:call-template>
</div>
</xsl:template>
<xsl:template name="LessLink">
<xsl:param name="thisNode" select="."/>
<div id="LessMoreLink">
<br />
<a id="LessLink{$thisNode/@ID}" href="javascript:" onclick="javascript:return CollapseBody('{$thisNode/@GUID}','{$thisNode/@GUID}',this);">
<img id="lessIcon" border="0" align="absmiddle" alt="{$thisNode/../@resource.wss.LessText}" src="/_layouts/images/dlmin.gif" />
<xsl:value-of select="$thisNode/../@resource.wss.LessText"/>
</a>
</div>
</xsl:template>
<xsl:template name="FullBody">
<xsl:param name="thisNode" select="."/>
<xsl:variable name="MessageBodyText">
<xsl:call-template name="MessageBody">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="@RichText='TRUE'">
<xsl:value-of select="$MessageBodyText" disable-output-escaping ="yes"/>
</xsl:when>
<xsl:otherwise>
<!--todo: deal with autonewline stuffs.-->
<xsl:value-of select="$MessageBodyText" disable-output-escaping ="yes"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="ToggleQuotedText">
<xsl:param name="thisNode" select="."/>
<xsl:variable name="CorrectBody">
<xsl:call-template name="CorrectBodyToShow">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="CorrectBody">
<xsl:call-template name="CorrectBodyToShow">
<xsl:with-param name="thisNode" select="$thisNode" />
</xsl:call-template>
</xsl:variable>
</xsl:template>
<xsl:template name="MessageBody">
<xsl:param name="thisNode" select="."/>
<xsl:variable name="CorrectBody">
<xsl:call-template name="CorrectBodyToShow">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$CorrectBody='TrimmedBody'">
<xsl:value-of select="$thisNode/@TrimmedBody"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$thisNode/@Body"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="LimitedBody">
<xsl:param name="thisNode" select="."/>
<xsl:variable name="MessageBodyText">
<xsl:call-template name="MessageBody">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
</xsl:choose>
</xsl:template>
<xsl:template name="MoreLink">
<xsl:param name="thisNode" select="."/>
<div id="moreTextLink"><br />
<a id="MoreLink{$thisNode/@ID}" href="javascript:" onclick="javascript:return ExpandBody('{$thisNode/@GUID}'','{$thisNode/@GUID}',this);">
<span style="height:13px;width:13px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust"><img src="/_layouts/images/fgimg.png" alt="{$thisNode/../@resource.wss.MoreText}" style="left:-0px !important;top:-238px !important;position:absolute;" id="moreIcon" border="0" align="absmiddle" /></span><xsl:value-of select="$thisNode/../@resource.wss.ShowQuotedMessages"/>
<xsl:value-of select="$thisNode/../@resource.wss.MoreText"/>
</a>
</div>
</xsl:template>
<xsl:template name="BodyWasExpanded">
<xsl:param name="thisNode" select="."/>
<xsl:choose>
<xsl:when test="$CAML_Expand and contains($CAML_Expand, $thisNode/@GUID)">TRUE</xsl:when>
<xsl:otherwise>FALSE</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="QuotedTextWasExpanded">
<xsl:param name="thisNode" select="."/>
<xsl:choose>
<xsl:when test="$CAML_ShowOriginalEmailBody and contains($CAML_ShowOriginalEmailBody, $thisNode/@GUID)">TRUE</xsl:when>
<xsl:otherwise>FALSE</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="CorrectBodyToShow">
<xsl:param name="thisNode" select="."/>
<xsl:variable name="WasExpanded">
<xsl:call-template name="QuotedTextWasExpanded">
<xsl:with-param name="thisNode" select ="$thisNode"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$WasExpanded='TRUE'">UnTrimmedBody</xsl:when >
<xsl:otherwise>
<!-- If we have an unedited item with a TrimmedBody, show that. Otherwise, show Body.-->
<xsl:choose>
<xsl:when test="$thisNode/@Created. =$thisNode/@Modified.">
<xsl:variable name="isRootPost">
<xsl:call-template name="IsRootPost">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$isRootPost='TRUE'">BODY</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$thisNode/@TrimmedBody=''">BODY</xsl:when>
<xsl:otherwise>TrimmedBody</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>Body</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="IsRootPost">
<xsl:param name="thisNode" select="."/>
<xsl:variable name="V_ShortestThreadIndexId">
<xsl:choose>
<xsl:when test="@FSObjType = '1'">
<xsl:choose>
<xsl:when test="$thisNode/@ShortestThreadIndexId='0'">
<xsl:value-of select="$thisNode/@ID"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$thisNode/@ShortestThreadIndexId"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$thisNode/@ShortestThreadIndexIdLookup"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$V_ShortestThreadIndexId=''">
<xsl:variable name="indentLevel">
<xsl:call-template name="IndentLevel">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$indentLevel=0">TRUE</xsl:when>
<xsl:otherwise>FALSE</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$V_ShortestThreadIndexId=$thisNode/@ID">TRUE</xsl:when>
<xsl:otherwise>FALSE</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="IndentLevel">
<xsl:param name="thisNode" select="."/>
<xsl:value-of select="floor(string-length($thisNode/@ThreadIndex) div 10) - 4"/>
</xsl:template>
<xsl:template name="Indentation">
<xsl:param name="thisNode" select="."/>
<img src="/_layouts/images/blank.gif" width="{string-length($thisNode/@ThreadIndex) - 46}px" height="1px" alt="" />
</xsl:template>
<xsl:template name="IndentStatusBar">
<xsl:param name="thisNode" select="."/>
<!--Brent Edit-->
<div id="statusBarIndent{generate-id()}">
<xsl:call-template name="Indentation">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
<xsl:call-template name="StatusBar">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
</div>
</xsl:template>
<xsl:template match="FieldRef[@Name='ReplyNoGif']" mode="Computed_body" ddwrt:dvt_mode="body">
<xsl:param name="thisNode" select="."/>
<xsl:call-template name="ReplyNoGif">
<xsl:with-param name="thisNode" select ="$thisNode"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="FieldRef_Thread_StatusBar_Computed_body" match="FieldRef[@Name='StatusBar']" mode="Computed_body" ddwrt:dvt_mode="body">
<xsl:param name="thisNode" select="."/>
<xsl:call-template name="StatusBar">
<xsl:with-param name="thisNode" select="$thisNode"/>
<xsl:with-param name="indent" select="0"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="StatusBar">
<xsl:param name="thisNode" select="."/>
<xsl:param name="indent" select="1"/>
<xsl:variable name="indentLevel">
<xsl:call-template name="IndentLevel">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
</xsl:variable>
<div id="mainContainer{generate-id()}">
<a name="{$thisNode/@GUID}"></a>
<xsl:choose>
<xsl:call-template name="IfHasRight">
<xsl:with-param name="thisNode" select="$thisNode" />
</xsl:call-template>
</xsl:choose>
</div >
<xsl:if test="$Collapse">
<xsl:attribute name="style">display:none</xsl:attribute>
</xsl:if>
<div id="linkDisplay{generate-id()}"><a id="DisplayLink{$thisNode/@ID}" href="{$FORM_DISPLAY}&ID={$thisNode/@ID}" onclick="EditLink2(this,{$ViewCounter});return false;" target="_self"><nobr><xsl:value-of select="'View Properties'" /></nobr></a></div>
<xsl:variable name="hasRight">
<xsl:call-template name="IfHasRight">
<xsl:with-param name="thisNode" select="$thisNode" />
</xsl:call-template>
</xsl:variable>
<xsl:if test="$hasRight"><img src="/_layouts/images/blank.gif" alt="" /><div id="buttonReply{generate-id()}">
<xsl:call-template name="ReplyNoGif">
<xsl:with-param name="thisNode" select="$thisNode" />
</xsl:call-template>
</div>
</xsl:if>
</xsl:template>
<xsl:template name="ReplyNoGif">
<xsl:param name="thisNode" select="."/>
<a id="ReplyLink{$thisNode/@ID}" href="{$ENCODED_FORM_NEW}&ContentTypeId=0x0107&DiscussionParentID={$thisNode/@ID}" onclick="EditLink2(this,{$ViewCounter});return false;" target="_self">
<img id="replyButton{generate-id()}" border="0" align="middle" alt="{$thisNode/../@resource.wss.ReplyLinkText}" src="/_layouts/images/reply.gif" />
<xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">&nbsp;</xsl:text>
<nobr><b>
<xsl:value-of select="'Reply'"/>
</b></nobr>
</a>
</xsl:template>
<xsl:template mode="Item" match="Row[../../@BaseViewID='1']">
<xsl:param name="Fields" select="."/>
<xsl:param name="Collapse" select="."/>
<xsl:param name="Position" select="1" />
<xsl:variable name="thisNode" select="."/>
<xsl:for-each select="$Fields">
<xsl:if test="$Collapse">
<xsl:attribute name="style">display:none</xsl:attribute>
</xsl:if>
<xsl:call-template name="IndentStatusBar">
<xsl:with-param name="thisNode" select="$thisNode"/>
</xsl:call-template>
<xsl:if test="$Collapse">
<xsl:attribute name="style">display:none</xsl:attribute>
</xsl:if>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="position()=1">ms-disc-bordered</xsl:when>
<xsl:otherwise>ms-disc-bordered-noleft</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="@Name='Threading'">
<xsl:attribute name="width">100%</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="PrintFieldWithDisplayFormLink" select=".">
<xsl:with-param name="thisNode" select="$thisNode"/>
<xsl:with-param name="Position" select="$Position"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:template>
<xsl:template mode="Item" match="Row[../../@BaseViewID='2']">
<xsl:param name="Fields" select="."/>
<xsl:param name="Collapse" select="."/>
<xsl:param name="Position" select="1" />
<xsl:variable name="thisNode" select="."/>
<xsl:if test="$Collapse">
<xsl:attribute name="style">display:none</xsl:attribute>
</xsl:if>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="position()=1">ms-disc-padabove</xsl:when>
<xsl:otherwise>ms-disc-nopad</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:for-each select="$XmlDefinition/ViewFields/FieldRef[@Name='StatusBar']">
<xsl:apply-templates mode="PrintFieldWithDisplayFormLink" select=".">
<xsl:with-param name="thisNode" select="$thisNode"/>
<xsl:with-param name="Position" select="$Position"/>
</xsl:apply-templates>
</xsl:for-each>
<xsl:if test="$Collapse">
<xsl:attribute name="style">display:none</xsl:attribute>
</xsl:if>
<xsl:for-each select="$Fields">
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="position()=1">ms-disc-bordered</xsl:when>
<xsl:otherwise>ms-disc-bordered-noleft</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="@Name='BodyAndMore'">
<xsl:attribute name="width">100%</xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="PrintFieldWithDisplayFormLink" select=".">
<xsl:with-param name="thisNode" select="$thisNode"/>
<xsl:with-param name="Position" select="$Position"/>
</xsl:apply-templates>
</xsl:for-each>
<xsl:if test="$Collapse">
<xsl:attribute name="style">display:none</xsl:attribute>
</xsl:if>
<img src="/_layouts/images/blank.gif" width="1px" height="15px" alt=""/>
</xsl:template>
<xsl:template name="FieldRef_Thread_UserBody" match="FieldRef" mode="User_body" ddwrt:dvt_mode="body">
<xsl:param name="thisNode" select="."/>
<xsl:choose>
<xsl:when test="$XmlDefinition/@BaseViewID='1' or $XmlDefinition/@BaseViewID='2'">
<xsl:value-of disable-output-escaping="yes" select="$thisNode/@*[name()=concat(current()/@Name, '.span')]" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="$thisNode/@*[name()=current()/@Name]" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="View_Thread_Summary_RootTemplate" match="View[List/@TemplateType='108' and @BaseViewID='0']" mode="RootTemplate" ddwrt:dvt_mode="root">
<xsl:apply-templates select="." mode="full" />
</xsl:template>
<xsl:template name="View_Thread_Default_RootTemplate" match="View[List/@TemplateType='108']" mode="RootTemplate" ddwrt:dvt_mode="root" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
<xsl:call-template name="CTXGeneration"/>
<xsl:if test="not($NoAJAX)">
<iframe src="javascript:false;" id="FilterIframe{$ViewCounter}" name="FilterIframe{$ViewCounter}" style="display:none" height="0" width="0" FilterLink="{$FilterLink}"></iframe>
</xsl:if>
<xsl:attribute name="class">
<xsl:choose><!-- Any time we display 0 items in a view = class="ms-viewEmpty" -->
<xsl:when test="$dvt_RowCount = 0">ms-viewEmpty</xsl:when>
<xsl:otherwise>
<xsl:choose><!-- Threaded/Flat view with non-zero number of items = class="ms-disc" -->
<xsl:when test="(@BaseViewID='1' or @BaseViewID='2')">ms-disc</xsl:when>
<!-- Subject view with non-zero number of items = class="ms-listviewtable" -->
<xsl:otherwise>ms-listviewtable</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:apply-templates select="." mode="full" />
<xsl:call-template name="pagingButtons" />
<xsl:if test="Toolbar[@Type='Freeform'] or ($MasterVersion=4 and Toolbar[@Type='Standard'])">
<xsl:call-template name="Freeform">
<xsl:with-param name="AddNewText">
<xsl:choose>
<xsl:when test="List/@TemplateType='108'"><xsl:value-of select="'Add new discussion'" /></xsl:when>
<xsl:otherwise><xsl:value-of select="'Add new item'" /></xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="ID">
<xsl:choose>
<xsl:when test="List/@TemplateType='108'">idHomePageNewDiscussion</xsl:when>
<xsl:otherwise>idHomePageNewItem</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="EmptyTemplate">
<xsl:value-of select="$NoAnnouncements"/>
<xsl:if test="$ListRight_AddListItems = '1'">
<xsl:if test="not (BaseViewID='1' or @BaseViewID='2')">
<xsl:text ddwrt:whitespace-preserve="yes" xml:space="preserve"> </xsl:text>
<xsl:value-of select="$NoAnnouncementsHowTo"/>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Any Help is greatly appreciated!!