item style edit in sharepoint 2013

时间:2022-03-05 01:08:08

标题头添加属性:(如果需要使用ddwrt)
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">

<xsl:template name="MyCustomStyle" match="Row[@Style='MyCustomStyle']" mode="itemstyle">
<xsl:variable name="SafeLinkUrl">
<xsl:call-template name="OuterTemplate.GetSafeLink">
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="DisplayTitle">
<xsl:call-template name="OuterTemplate.GetTitle">
<xsl:with-param name="Title" select="@Title"/>
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:variable>
<div class="item link-item">
<xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
<a href="{$SafeLinkUrl}" title="{$DisplayTitle}">
<xsl:if test="$ItemsHaveStreams = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of select="@OnClickForWebRendering"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'">
<xsl:attribute name="onclick">
<xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="string-length($DisplayTitle) &gt; 10">
<xsl:value-of select="substring($DisplayTitle,1,10)"/>...
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$DisplayTitle"/>
</xsl:otherwise>
</xsl:choose>
</a>
<xsl:if test="ddwrt:IfNew(string(@Created))">
<img src="/_layouts/15/2052/images/new.gif" alt="New" border="0"/>
</xsl:if>
</div>
</xsl:template>