Personalización avanzada > Services and Infrastructure Customization > Import Export Framework > Using Extension Functions in XSL for Import or Export Management
Using Extension Functions in XSL for Import or Export Management
To use extension functions in XSL for import or export management, follow these steps:
1. Make sure that you have created a custom ExtensionFunction using the full-interface mechanism.
* 
To create a custom extension function using the full-interface mechanism, see Full Interface Mechanism for XSLT with Saxon.
2. Call the ExtensionFunction function in the XSL file.
3. Create a delegate that implements the ExtensionFunctionDefinitionDelegate.
4. Register all the user extension functions in the newly created custom class. Refer to the example below:
public class ExtensionFunctionDefinitionsIXB implements ExtensionFunctionDefinitionDelegate{
private static final Logger logger = LogR.getLoggerInternal(ExtensionFunctionDefinitionsIXB.class.getName());
@Override
public ExtensionFunctionDefinition[] getExtensionDefinitions() {
if(logger.isDebugEnabled()) {
logger.debug("Checking Extension Function Definitions required for executing XSL.");
}
ExtensionFunctionDefinition[] defs = new ExtensionFunctionDefinition[] {
new ExtensionFunctionTest() // User created function list
};
return defs;
}
}
5. Add an entry to the <Windchill>/codebase/service.properties.xconf file for the newly created delegate. The selector must be specified by the user as follows:
IXBExtenstionFunctions
PDXExtenstionFunctions
For example,
<Option cardinality="duplicate" requestor="java.lang.Object" serviceClass="com.ptc.windchill.xsl.extn.ExtensionFunctionDefinitionsIXB" selector="IXBExtenstionFunctions" />
<Option cardinality="duplicate" requestor="java.lang.Object" serviceClass="com.ptc.windchill.xsl.extn.ExtensionFunctionDefinitionsPDX" selector="PDXExtenstionFunctions" />
If the user used include or import statements in the XSL file, then follow these steps:
1. Create a new IXBExpImpIncludes directory in the Windchill home directory.
* 
To use include or import statements, user must add all the XSL files under the IXBExpImpIncludes directory.
<xsl:import href="testIncludeBase.xsl"/>
<xsl:template match="/">
<xsl:call-template name="generateURLHref"></xsl:call-template>
</xsl:template>
Refer to example below on how to use include or import in import rule XSL file.
¿Fue esto útil?