Question

I am attempting to customize the aggregate section of a grouped list that I have created through a schema.xml in a Visual Studio project. I have created a mapped folder to {SharePointRoot}\Template\LAYOUTS\XSL and created a folder called ratings under it. In this folder, I created viewgrouped.xsl and changed my XSLLink element to point to this for my view. In order to check and see if this is working, I copied over the aggregate template from vwstyles.xsl and made the match attribute more specific by adding a check for TemplateType. I then removed all the contents of the template so my custom xsl looks like this:

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" 
xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0"
exclude-result-prefixes="xsl msxsl ddwrt"
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:asp="http://schemas.microsoft.com/ASPNET/20"
xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:SharePoint="Microsoft.SharePoint.WebControls"
xmlns:pcm="urn:PageContentManager" xmlns:ddwrt2="urn:frontpage:internal"
ddwrt:oob="true">

<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:include href="/_layouts/15/xsl/main.xsl"/>
<xsl:template match="FieldRef|View[List/@TemplateType='10054']" mode="aggregate" ddwrt:dvt_mode="body">
    <xsl:param name="Rows" select="."/>
    <xsl:param name="GroupLevel" select="1"/>
</xsl:template>

I would have thought that this would have caused the summary row to not be printed. However, when I ran the application and navigated to the view, everything still looked just as it did with the default template. I tried adding <p class="group-level"><xsl:value-of select="$GroupLevel"/></p> below the second <xsl:param, but that didn't show up either. Can someone tell me how to get this template to be called in place of the original?

Était-ce utile?

La solution

I have found that in SharePoint 2016 (at least on-premises), most of the view is not controlled by XSL. The best way to change the way a view looks is to create a custom aspx page and use that to add your own javascript to the view. You can then use JSLink to add templates and override the functions used to create the view.

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top