添加自定义属性
TAL 实施会限制变换输出中包含的元素。如果要发送一些附加输入参数,可以在预定义变量中包含附加属性。随后,将由 TAL 处理这些新属性。
TAL 会加载预定义变量中的属性。这些属性可能具有以下特征:
• 单值或多值
• 含或不含 Enum 键
• 含或不含转换
Px 束中的输入示例
下面是一个使用 DMPmap.xml 文件的“信息结构”(IS) 或“发布结构”(PS) 的输入示例:
<data name="customattr1" transidref="457b17e2cf7e2ea3" xml:lang="en-US">Value of the attribute 1</data>
<data name="customattr2" key="customKey">Value of the attribute 2</data>
<data name="customattr3">Value of the attribute 2</data>
下面是一个针对 PDF、XML、IEGraphic、PL (部件列表) 或 PART 的示例,其中属性包含在各自的文件中:
<Property token="customattr1">
<Value key="customKey1">Val1</Value>
<Value key="customKey2">Val2</Value>
<Value key="customKey3">Val3</Value>
</Property>
<Property token="customattr2">
<Value transidref="457b17e2cf7e2ea0" xml:lang="en-US" key="customKey11">Val21</Value>
<Value transidref="457b17e2cf7e2ea1" xml:lang="en-US" key="customKey12">Val22</Value>
</Property>
<Property token="customattr3">
<Value transidref="457b17e2cf7e2ea0" xml:lang="en-US" key="customKey31">Val31</Value>
</Property>
自定义说明
要加载这些元数据属性,您必须将属性设置为预定义变量。属性之间的这些变量值应以逗号分隔。以下为一个示例:
<xsl:variable name="CUSTOM_IS_SOFT_ATTRIBUTES" select="concat(',customattr1,customattr2,customattr3,')"/>
<xsl:variable name="CUSTOM_TYPE_SOFT_ATTRIBUTES" select="concat(',customattr1,customattr2,customattr3,')"/>
每种变换 TYPE 都具有其自身用于自定义属性的变量集 (CUSTOM_name)。下面的列表提供每种类型的自定义文件和变量名称。
IS 或 PS
自定义文件:TranformationDriver\IS\customizations.xsl
变量名称:CUSTOM_IS_SOFT_ATTRIBUTES
PH
自定义文件:TranformationDriver\PH\customizations.xsl
变量名称:CUSTOM_PH_SOFT_ATTRIBUTES
IEXML
自定义文件:TranformationDriver\IEXML\customizations.xsl
变量名称:CUSTOM_IEXML_SOFT_ATTRIBUTES
PDF
自定义文件:TranformationDriver\PDFM\customizations.xsl
变量名称:CUSTOM_PDFM_SOFT_ATTRIBUTES
GRAPHIC
自定义文件:TranformationDriver\GRAPHIC\customizations.xsl
变量名称:CUSTOM_GRAPHIC_SOFT_ATTRIBUTES
PART RELATION
自定义文件:TranformationDriver\PARTRELATIONS\abstractCustomPx2PartsRelations.xsl
此文件包含在 customPx2PartsRelations.xsl 中。
变量名称:CUSTOM_PARTSRELATIONS_SOFT_ATTRIBUTES
这适用于 Rel/Metadata 输入。
PARTSLIST
自定义文件:TranformationDriver\PARTSLIST\abstractCustomPartsList2Feed.xsl
此文件包含在 customPartsList2Feed.xsl 中。
此类型具有多个变量:
◦ CUSTOM_PARTSLIST_PARTLIST_SOFT_ATTRIBUTES
这适用于 PartsList/PartList/Metadata 输入。
◦ CUSTOM_PARTSLIST_ITEMS_ITEM_PARTLISTITEM_SOFT_ATTRIBUTES
这适用于 PartsList/Items/Item/PartListItem/Metadata 输入。
◦ CUSTOM_PARTSLIST_PARTLIST_META_SOFT_ATTRIBUTES
这适用于 PARTSLIST .meta 输入。
◦ CUSTOM_PARTSLIST_ITEMS_ITEM_PARTLISTITEM_PART_SOFT_ATTRIBUTES
这适用于 PartsList/Part/Metadata 和 PartsList/Items/Item/Part/Metadata 输入。
◦ CUSTOM_PARTSLIST_IMAGES_IMAGE_SOFT_ATTRIBUTES
这适用于 PartsList/Images/Image/imageObj/Metadata 输入。
PART
自定义文件:TranformationDriver\PARTS\abstractCustomPart2Feed.xsl
对于此类型,需要使用 mode="translate" 在 XSL 模板中添加自定义属性的模板调用。请参阅以下示例。
<xsl:template match="Metadata[starts-with(@source,'wt.part.WTPart')]"
mode="custom.wt.part.WTPart">
<xsl:apply-templates select="Property[@token = 'customattr1']" mode="translate"/>
<xsl:apply-templates select="Property[@token = 'customattr2']" mode="translate"/>
<xsl:apply-templates select="Property[@token = 'customattr3']" mode="translate"/>
</xsl:template>
自定义属性加载到
Servigistics InService 信息库后,需要对视图样式表和类型特性进行其他自定义,才能将用户界面中的属性用于显示或搜索。有关详细信息,请参阅
更新视图样式表和
更新默认变换进程。