Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Ok, I have searched and searched for an answer on how to customize the thread.xsl file. So I have copied the file, and renamed it as thread2.xsl. In the threaded.aspx page, I have changed the GhostedXslLink to reference the new file GhostedXslLink="thread2.xsl". I have save the page, I can see my changes reflected within SPD, but the browser still shows me the old template. Any Ideas Why??

Update: Here's the code:

<WebPartPages:XsltListViewWebPart runat="server" Description="Use the Team Discussion list to hold newsgroup-style discussions on topics relevant to your team." ListDisplayName="" PartOrder="2" Default="TRUE" HelpLink="" AllowRemove="True" IsVisible="True" AllowHide="True" UseSQLDataSourcePaging="True" ExportControlledProperties="False" IsIncludedFilter="" DataSourceID="" Title="Team Discussion" ViewFlag="402653185" NoDefaultStyle="" AllowConnect="True" DisplayName="Threaded" PageType="PAGE_DEFAULTVIEW" FrameState="Normal" PageSize="-1" PartImageLarge="" AsyncRefresh="False" ExportMode="NonSensitiveData" Dir="Default" DetailLink="/Lists/Team Discussion" EnableTheming="False" ShowWithSampleData="False" ListId="eb26c71f-c466-411d-a9ae-7372a657b18e" ListName="{EB26C71F-C466-411D-A9AE-7372A657B18E}" FrameType="Default" PartImageSmall="" IsIncluded="True" SuppressWebPartChrome="False" AllowEdit="True" ViewGuid="{0B1EA108-E3E5-46E5-8813-E747175FF805}" AutoRefresh="False" AutoRefreshInterval="60" AllowMinimize="True" WebId="00000000-0000-0000-0000-000000000000" ViewContentTypeId="0x0120020061C489FDBE1EA34DB10A6609E7D509AE" InitialAsyncDataFetch="False" GhostedXslLink="" MissingAssembly="Cannot import this Web Part." HelpMode="Modeless" ListUrl="" ID="g_0b1ea108_e3e5_46e5_8813_e747175ff805" ConnectionID="00000000-0000-0000-0000-000000000000" AllowZoneChange="True" TitleUrl="/Lists/Team Discussion" ManualRefresh="False" __MarkupType="vsattributemarkup" __WebPartId="{0B1EA108-E3E5-46E5-8813-E747175FF805}" __AllowXSLTEditing="true" WebPart="true" Height="" Width="" __designer:customxsl="fldtypes_Ratings.xsl"><ParameterBindings>
        <ParameterBinding Name="dvt_sortdir" Location="Postback;Connection"/>
        <ParameterBinding Name="dvt_sortfield" Location="Postback;Connection"/>
        <ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue=""/>
        <ParameterBinding Name="dvt_firstrow" Location="Postback;Connection"/>
        <ParameterBinding Name="OpenMenuKeyAccessible" Location="Resource(wss,OpenMenuKeyAccessible)" />
        <ParameterBinding Name="open_menu" Location="Resource(wss,open_menu)" />
        <ParameterBinding Name="select_deselect_all" Location="Resource(wss,select_deselect_all)" />
        <ParameterBinding Name="idPresEnabled" Location="Resource(wss,idPresEnabled)" />
        <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noitemsinview_discboard)" />
        <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noitemsinview_discboard_howto3)" />
        <ParameterBinding Name="CAML_Expand" Location="Form(CAML_Expand)" />
        <ParameterBinding Name="CAML_ShowOriginalEmailBody" Location="Form(CAML_ShowOriginalEmailBody)" />
        <ParameterBinding Name="ByText" Location="Resource(wss,2000)" />
    </ParameterBindings>
    <XmlDefinition>
        <View Name="{0B1EA108-E3E5-46E5-8813-E747175FF805}" DefaultView="TRUE" DefaultViewForContentType="TRUE" Type="HTML" TabularView="FALSE" IncludeRootFolder="TRUE" DisplayName="Threaded" Url="/Lists/Team Discussion/Threaded.aspx" Level="1" BaseViewID="1" ContentTypeID="0x0120020061C489FDBE1EA34DB10A6609E7D509AE" ImageUrl="/_layouts/images/vwdisc.png" CssStyleSheet="discthread.css">
            <Query>
                <OrderBy Override="TRUE">
                    <FieldRef Name="Threading"/>
                </OrderBy>
            </Query>
            <ViewFields>
                <FieldRef Name="Threading"/>
            </ViewFields>
            <RowLimit Paged="TRUE">25</RowLimit>
            <Aggregations Value="Off"/>
            <Toolbar Type="Standard"/>
        </View>
    </XmlDefinition>
    <XslLink>/Style%20Library/XSL%20Style%20Sheets/thread2.xsl</XslLink>
            <DataFields>
            </DataFields>
            </WebPartPages:XsltListViewWebPart>

Here is the error that I get:

06/13/2012 13:59:53.78 w3wp.exe (0x1DB4) 0x1F44 SharePoint Foundation Web Parts 89a1 High Error while executing web part: System.Xml.Xsl.XslTransformException: An item of type 'Attribute' cannot be constructed within a node of type 'Root'. at System.Xml.Xsl.Runtime.XmlQueryOutput.ThrowInvalidStateError(XPathNodeType constructorType) at System.Xml.Xsl.Runtime.XmlQueryOutput.WriteStartAttribute(String prefix, String localName, String ns) at System.Xml.Xsl.Runtime.XmlQueryOutput.WriteStartAttributeLocalName(String localName) at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current) at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at Ro... 877aac16-ef57-4be7-9035-029f71c7b215

share|improve this question
    
Based on the error message you've posted, the problem is inside your XSLT. This means your customized XSLT file is applied, so I assume the initial problem is solved. I would appreciate if you posted the customization XSLT code and the complete call stack (error message above doesn't include full call stack) in a separate question. –  Andrey Markeev Jun 13 '12 at 20:01
add comment

1 Answer 1

When you change a page in SPD, it becomes customized (unghosted). Thus, GhostedXslLink no longer works.

More details about ghosted and unghosted pages here:

You should use XslLink property instead of GhostedXslLink for unghosted pages. Just change it in the property editor in SPD:

enter image description here

Also, I'd recommend you to use xsl:import rather than copying the whole thread.xsl file.

Update:

I was able to attach custom XSLT file to a Discussion board without any difficulties in my local environment. Here is how I've done it (in case this could help you):

  1. copy-pasted thread.xsl to thread2.xsl
  2. added html code <h1>test!</h1> to EmptyTemplate of this file, inside <td> element (full code snippet below)
  3. created blank new discussion board list
  4. switched page into edit mode and opened webpart properties for the list view webpart
  5. in webpart properties tab, entered "/_layouts/XSL/thread2.xsl" to Miscellaneous => XSL Link (which produces exactly the same result as changing XslLink property in SPD)
  6. applied changes

The result:

enter image description here

XSLT code for the EmptyTemplate:

  <xsl:template name="EmptyTemplate">
    <tr>
      <td class="ms-vb" colspan="99">
        <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"/>
            <h1>test!</h1>
          </xsl:if>
        </xsl:if>
      </td>
    </tr>
  </xsl:template>
share|improve this answer
    
Ok, so I used the XslLink property and I have now gotten a broken webpart, it states "This Web Part does not have a valid XSLT stylesheet: There is no XSL property available for presenting the data" I know that there is, the only thing that I have done is take out the Tables and replaced them with divs so i can control them better. –  Brenton Pierce Jun 13 '12 at 13:41
    
If I add the path /_layouts/xsl/thread2.xsl then the error goes away yet I still see the default threaded xsl view. –  Brenton Pierce Jun 13 '12 at 13:50
    
see code update above. –  Brenton Pierce Jun 13 '12 at 16:41
    
Unfortunately I haven't been able to reproduce your issue. My only guess: something is wrong with the XSL customization. Which template did you change and how? Please note: some templates in this file match specific BaseViewID-s (i.e. match="Row[../../@BaseViewID='2']" matches views with BaseViewID=2), so if you changed common template (i.e. match=Row), but the view has BaseViewID set to one of system values, the more specific template will be applied. –  Andrey Markeev Jun 13 '12 at 18:28
    
I've updated my answer with my steps, please consider following them so you could at least determine there the problem is. I mean, maybe your custom file is actually applied, but you placed your customization into a wrong template or smth like this :) –  Andrey Markeev Jun 13 '12 at 18:30
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.