Amministrazione generale > Importazione ed esportazione in Windchill > Import and Export Policies, Mapping Rules, and Conflict Messages > XSL-based Policy Files
  
XSL-based Policy Files
You can write policy files to apply to a specific export or import process, or to a set of export or import processes. Conditions that are set in the policy files can selectively apply actions that available in the user interface. The following actions are available in import: ignore, create new object, substitute object, and unlock and iterate. Policy files can apply the lock action in export. You set properties in mapping rules files by editing the files; you cannot use the xconfmanager utility for this purpose. If you do not set properties through a graphical user interface or in a mapping file, you add or edit properties with the xconfmanager utility.
For more information, see Using the xconfmanager Utility.
Policy File Examples
The following examples show the syntax of an XSL-based policy file for both import and export. Comments explaining the use of policy files are embedded within the examples.
Import
<?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>
Export
<?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>