使用sharepoint设计器链接到单行文本字段

时间:2013-02-11 14:24:35

标签: sharepoint sharepoint-2010 sharepoint-designer

我使用的是Sharepoint 2010,我在文档库中创建了一行文本字段列。我想将该列中的文本超链接到上传到文档库中的文件。如果我在sharepoint设计器中使用以下代码,则无法正常工作。有人可以帮助我。

<a href="/{$thisNode/@FileLeafRef}"><xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes" /></a>

感谢。

编辑: 奇怪的是,如果我在视图中公开名称列,那么一切正常。我不知道为什么它表现得像这样。有人可以请我探索。

2 个答案:

答案 0 :(得分:0)

检查Name列的XML定义。
如果您更改它而不是链接到文档,它可能会解决您的问题。

答案 1 :(得分:0)

通过SharePoint Designer(SPD)customizing the rendering of a Field on the List View

确保从模板中删除ddwrt:ghost属性。

用法

例如,对于字段内部名称ShortDesc,SPD生成了以下字段模板:

<xsl:template name="FieldRef_Text_body.ShortDesc" ddwrt:dvt_mode="body" match ="FieldRef[@Name='ShortDesc']" mode="Text_body" ddwrt:ghost="show">
                <xsl:param name="thisNode" select="."/>
                <xsl:choose>
                    <xsl:when test="@AutoHyperLink='TRUE'">
        <xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping ="yes"/>
      </xsl:when>
                    <xsl:otherwise>
        <xsl:value-of select="$thisNode/@*[name()=current()/@Name]"/>
      </xsl:otherwise>
                </xsl:choose>
  </xsl:template> 

因此,为了将此字段呈现为链接:

a)删除ddwrt:ghost="show"属性

b)替换字段呈现代码

<xsl:template name="FieldRef_Text_body.ShortDesc" ddwrt:dvt_mode="body" match ="FieldRef[@Name='ShortDesc']" mode="Text_body" >
                <xsl:param name="thisNode" select="."/>
                <xsl:choose>
                    <xsl:when test="@AutoHyperLink='TRUE'">
        <a href="/{$thisNode/@FileLeafRef}"><xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes" /></a>
      </xsl:when>
                    <xsl:otherwise>
        <xsl:value-of select="$thisNode/@*[name()=current()/@Name]"/>
      </xsl:otherwise>
                </xsl:choose>
  </xsl:template>

ghost属性用于标记sharepoint认为是静态的任何xslt,因此不会接受任何更改。删除ghost属性时,应保留更改

相关问题