Updating the Default Transformation Process
Servigistics InService provides transformation stylesheets and a default customization stylesheet is included in the transformation stylesheets. It is recommended that you use the customization stylesheet to modify the existing definitions or process. Follow these guidelines to update the customization stylesheet.
Each data type’s transform stylesheet includes a stylesheet fragment named customizations.xsl. Following is the part of the stylesheet that shows how the customization stylesheet gets embedded in the transform stylesheet:
<?xml version="1.0"?>
<!--
Stylesheet to perform OOTB transformation on a source xml
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:stl="http://www.enigma.com/Styling" xmlns:tmpl="http://www.ptc.com/2014/Template-Document"
extension-element-prefixes="stl" version="1.0">
<xsl:output indent="yes" method="xml" />
<!--
Customization specific code will go in the stylesheet included below.
-->
<xsl:include href="customizations.xsl"/>
...
</xsl:stylesheet>
|
Do not make any changes to the regular transformation stylesheet, as this file is overwritten whenever there is any incremental update.
|
By default, customizations.xsl is an empty stylesheet. The customization branch should use a customized version of the stylesheet and the XSLT priority construct to override or complement the transformation. If a customization is done and the output format needs to be modified, dependent files need to be updated. For example, if the parts transformation output is changed then the part specific template must be modified as well so that both are synchronized.
XSLT has a notion of priorities so that anything that is matched by an existing template can simply be overridden by supplying an equivalent match expression with higher priority. For example, if you just want to customize handling of this existing XSL code:
<xsl:template match="Metadata">
To override it, you would add a template such as the following:
<xsl:template match="Metadata" priority="2">
In the custom stylesheet you can modularize customizations.xsl and pull in any number of additional XSLT stylesheet fragments. In this case, customizations.xsl could simply be a number of additional xsl:include statements. For these inclusions, the result after the XSLT engine has processed the files is the template match with the highest priority value triggers the transform and all the other matches for same content are ignored.
In this way you can effectively override everything in the existing processing, starting from the root of the document, or just selectively do some specific handling such as modifying a Property and Value pair mapping.
Another customization convention in the transform stylesheet is to add certain Property/@token values in comma-separated strings stored in XSLT variables to support opt-in or opt-out functionality, such as picking which soft attributes to propagate.