0

I have created a custom field type in SharePoint 2016 inheriting from SPFieldMultiLineText. The field behaves as expected for the most part.

I now have the task of creating XSL styles for list view rendering. Unfortunately I haven't been successful in even applying a basic XSL stylesheet to target my custom field type, and I am convinced it is something simple I am missing.

I am aware I can achieve DispForm/EditForm and List view rendering for custom field types using CSR / JSLink, but some other constraints of which I cannot detail here prevent me from applying this approach (unless absolutely necessary).

Below is my custom XSL of which resides in a file called fldtypes_SearchFieldType.xsl (This is simply the out of box note snippet with an additional class added to the containing DIV):

<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:ddwrt2="urn:frontpage:internal">

  <xsl:template  match="FieldRef[@Name='SearchPicker']" mode="Note_body">
    <xsl:param name="thisNode" select="."/>
    <div dir="{@Direction}" class="ms-rtestate-field blahblah">
      <xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes"/>
    </div>
  </xsl:template>
</xsl:stylesheet>

enter image description here

And here is a snippet of my custom field type definition of which otherwise functions correctly:

<Field Name="TypeName">SearchPicker</Field>
    <Field Name="ParentType">Note</Field>
    <Field Name="TypeDisplayName">SearchPicker</Field>

Here you can see that the XSL file has been deployed successfully to the hive

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.