基于 XSL 的策略文件
可以编写策略文件以应用于一个特定的导出或导入过程,或者一组导出或导入过程。策略文件中设定的条件可以有选择地应用于用户界面中的可用操作。导入时可以进行以下操作:忽略、创建新对象、替代对象以及解锁和迭代。策略文件在导出中可应用“锁定”操作。设置映射规则文件中属性的方法是编辑这些文件,不能将 xconfmanager 实用程序用于此目的。如果未通过图形用户界面或映射文件设置特性,则可使用 xconfmanager 实用程序添加或编辑特性。
有关详细信息,请参阅“专业化管理”部分中的
使用 xconfmanager 实用程序。
策略文件示例
以下示例显示用于导入和导出的基于 XSL 策略文件的语法。示例中嵌入了解释策略文件用法的注释:
“导入”
<?xml version="1.0" ?>
<xsl.stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform"
version="2.0>
<!--
The following is a sample of a well-formed xsl. In the
cases where there are no specific actions to be
performed, the target xml (which is being transformed)
should be copied as it is, which is achieved by the
following:
<xsl:template match=@* | node()" priority="-9">
<xsl:copy><xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
-->
<xsl:template match="@* | node()" priority="-9">
<xsl:copy>
<xsl:apply-templates selecte="@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="WTPart">
<actionInfo>
<action:PickExistingObject</action>
</actionInfo>
</xsl:template>
<xsl:template match="WTDocument">
<actionInfo>
<action>PickExistingObject</action>
<actionInfo>
</xsl:template>
<xsl:template match="EPMDocument">
<actionInfo>
<action>PickExistingObject</action>
</actionInfo>
</xsl:template>
</xsl:stylesheet>
“导出”
<?xml version="1.0" ?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version=2.0">
<xsl:output method="xml" indent="no" encoding=UTF-8" />
<!--
The syntax of Export Policy is standard XSL syntax. The
output of XSLT using the XSL policy file must have at
most one element of the form:
<actionInfo>
<action>...</action>
</actionInfo>
-->
<!--
The following is a sample of a well-formed xsl. In the
cases where there are no specific actions to be
performed, the target xml (which is being transformed)
should be copied as it is, which is the default action
that would transpire as shown in the uncommented section
below.
-->
<!--
<xsl:template match=@* | node()" priority="-9">
<xsl:copy><xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match=’WTPart’>
<actionInfo>
<action>Checkout</action>
</actionInfo>
</xsl:template>
<xsl:template match=’WTDocument’>
<actionInfo>
<xsl:choose>
<xsl:when test="number"’TESTDOC-1’">
<action>Checkout</action>
</xsl:when>
<xsl:otherwise>
<action>Lock</action>
</xsl:otherwise>
</xsl:choose>
</actionInfo>
<xsl:template>
-->
<!-- Copy everything as is by default -->
<xsl:template match=@* | node()" priority="-9">
<xsl:copy>
<xsl:apply-templates select=@* | node()" />
</xsl:copy>
<xsl:template>
</xsl:stylesheet>