我有一个带有自定义字符串属性的 Sharepoint 自定义字段。它工作得很好,我可以通过我的自定义自定义控件设置属性并存储值。我想使用我的 XSL 文件并根据自定义属性的值来自定义列表视图中的字段呈现。
我怎样才能得到这个值?
[编辑] 这是字段 xml 定义:
<?xml version="1.0" encoding="utf-8" ?>
<FieldTypes>
<FieldType>
<Field Name="TypeName">Secure</Field>
<Field Name="ParentType">Text</Field>
<Field Name="TypeDisplayName">Secure</Field>
<Field Name="TypeShortDescription">Secure Field</Field>
<Field Name="UserCreatable">TRUE</Field>
<Field Name="ShowOnListCreate">TRUE</Field>
<Field Name="ShowOnSurveyCreate">TRUE</Field>
<Field Name="ShowOnDocumentLibraryCreate">TRUE</Field>
<Field Name="ShowOnColumnTemplateCreate">TRUE</Field>
<Field Name="Sortable">FALSE</Field>
<Field Name="Filterable">FALSE</Field>
<Field Name="FieldTypeClass">MyProject.SecureFields.SecureField, $SharePoint.Project.AssemblyFullName$</Field>
<Field Name="FieldEditorUserControl">/_controltemplates/SecureFieldPropertyEditor.ascx</Field>
<PropertySchema>
<Fields>
<Field Name="ShowedFieldName" Hidden="TRUE" DisplayName="ShowedFieldName" Type="Text" MaxLength="255">
<Default></Default>
</Field>
</Fields>
</PropertySchema>
</FieldType>
</FieldTypes>
这是 XSL:
<?xml version="1.0" encoding="utf-8"?>
<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[@FieldType = 'Secure']" mode="Text_body">
<xsl:param name="thisNode" select="." />
<xsl:variable name="showedFieldName" select="./@*[name()=current()/@ShowedFieldName]" />
<span style="background-color:lightgreen;font-weight:bold">
<xsl:value-of select="$showedFieldName"/>
</span>
</xsl:template>
</xsl:stylesheet>