Servigistics InService 發佈與載入 > 其他資訊 > TAL 自訂 > 新增自訂屬性
  
新增自訂屬性
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/MetadataPartsList/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 存放庫之後,檢視樣式表與類型內容中需要其他自訂,才能在使用者介面中使用屬性,來顯示或搜尋。如需詳細資訊,請參閱更新檢視樣式表更新預設轉換流程