在哪里为共享点列表添加禁用输出转义?

时间:2019-07-17 13:32:28

标签: xslt sharepoint sharepoint-online sharepoint-designer

是的,我知道这是重复的,但是其他答案现在已经过时了。我正在将SharePoint Online与SharePoint Designer 2013一起使用。

我想为SharePoint列表视图设置disable-output-escaping = yes。

这是我尝试过的:

  • 我将字段类型设置为数字。这适用于旧版本的SharePoint,但不再适用于在线SharePoint。
  • 我尝试在SharePoint Designer中打开它的设计视图,但在SharePoint Designer 2013中不再存在
  • 我尝试设置自定义XSL,但这只会导致错误。在哪里添加XSL以使其正常工作?本身引用main.xsl。如果我知道该文件在哪里,则可以将其复制为创建自己的XSL的起点,但是在站点的任何地方都找不到。

以下是我与aspx相关的部分:

<FieldRef Name="After_x0020_Mitigation"/></ViewFields>
<RowLimit Paged="TRUE">100</RowLimit><Aggregations Value="Off"/
<JSLink>clienttemplates.js</JSLink><XslLink default="TRUE">Main.xsl</XslLink>

2 个答案:

答案 0 :(得分:0)

我不知道在哪里放置“ disable-output-escaping = yes”,我找不到该信息。

但是,您可以使用字段模板来实现此结果。像这样的东西

(function () {  
    // Create an object that have the context information about the fields that we want to change the rendering of.   
    var nameFiledContext = {};  
    nameFiledContext.Templates = {};  
    nameFiledContext.Templates.Fields = {  
        // Apply the new hyperlink HTML Rendering to the field in your view.  Swap out "<Your Field Name>" for your field name 
        "<Your Field Name>": { "View": nameFiledTemplate }  
    };  
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(nameFiledContext);  
})();  
  
// This function applies the rendering logic 
function nameFiledTemplate(ctx) {  
    var name = ctx.CurrentItem.ID;  //Swap out name variable for whatever field contains your hyperlink name
            
    return "<a target='_blank' href='<Your Hyperlink Here>'>"   
        + name + "</a>";      //Put the url for your hyperlink in the href above
}  

答案 1 :(得分:0)

在XSL中,应该是这样的:

<xsl:value-of disable-output-escaping="yes" select="ddwrt:AutoNewLine(string(@Notes))" ddwrt:nbsp-preserve="yes"/>

如果在xslt中,则类似于以下内容:

    <tr>
    <td width="190px" valign="top" class="ms-formlabel" >
        <H3 class="ms-standardheader">|
            <nobr>Region< /nobr>

        </H3>
    </td>
    <td width="400px" valign="top" class="ms-formbody">
        <xsl:value-of select="@Region" disable-output-escaping="yes" /> 
    </td>
</tr>