How do I Create an XSL Transformation File

You create an XSL transformation file in Adapter Management. You can copy the content of an existing XSL transformation file to the new file and then make necessary edits.

To create an XSL transformation file:

  1. Log in to UCMDB as an administrator.
  2. Navigate to Data Flow Management > Adapter Management. ServiceManagerAdapter9.41 > Configuration Files.
  3. Click the Create new resource button .
  4. Select New Configuration File.
  5. Enter a name for the file. The file name should use this format: <AdapterID>/<filename>. For example: ServiceManagerAdapter9.41/test_relation_population.xslt.
  6. In the Package field, select the adapter name. For example, ServiceManagerAdapter9.41.
  7. Click OK. A file extension warning dialog is displayed.
  8. Click Yes to continue.

    UCMDB creates the new XSL transformation file in the Configuration Files folder of the adapter. For example, ServiceManagerAdapter9.41 > Configuration Files > ServiceManagerAdapter9.41/test_relation_population.xslt.

  9. Copy the content of an existing XSL transformation file to the new file. For example, for population you can copy the content of an out-of-the-box population XSL transformation file.
  10. Make necessary edits to the new file.

    Caution Invalid XML

    When removing XSL elements from an XSLT file, keep in mind that the remaining XML should be a valid XML file, which will be used to translate the UCMDB Query Definition.

Sample usages of XSLT

For your reference, the following are some samples of using XSLT functionalities in this integration.

Using choose to set CI subtypes:

<Type>switch</Type>
<xsl:variable name="prefix" select="'Value&gt;'"/>
<xsl:variable name="suffix" select="'&lt;/Value'"/>
<Subtype>
  <xsl:choose>
    <xsl:when test="contains(@node_role,concat($prefix,'atm_switch',$suffix))">ATM Switch</xsl:when>
    <xsl:when test="contains(@node_role,concat($prefix,'frame_relay_switch',$suffix))">Frame Relay Switch</xsl:when>
    <xsl:when test="contains(@node_role,concat($prefix,'lan_switch',$suffix))">Lan Switch</xsl:when>
    <xsl:otherwise><xsl:value-of select="@friendlyType"/></xsl:otherwise>
  </xsl:choose>
</Subtype>

Getting the substrings from a string:

<xsl:variable name="calculatedLocation" select="@calculated_location"/>
<Building>
  <xsl:value-of select="substring-after($calculatedLocation,' Building:')"/>
</Building>
<Floor>
  <xsl:value-of select="substring-before(substring-after($calculatedLocation,'Floor:'),' Building:')"/>
</Floor>
<Room>
  <xsl:value-of select="substring-before(substring-after($calculatedLocation,'Room:'),' Floor:')"/>
</Room>

Reading the value mappings from an XML file:

The SM_CIT_Subtype_list.xml file defines the value mappings for subtypes:

<lists>
  <list name="CIType_bizservice">
    <entry ucmdb="BusinessApplication" sm="Application Service"/>
    <entry ucmdb="BusinessService" sm="Business Service"/>
    <entry ucmdb="InfrastructureService" sm="Infrastructure Service"/>
  </list>
</lists>

The business_service_push.xslt file uses this mapping definition XML file:

<xsl:variable name="CIlists" select="document('SM_CIT_Subtype_list.xml')/lists"/>
<xsl:variable name="CIT" select="@bdmType"/>
<xsl:for-each select="$CIlists/list[@name='CIType_bizservice']">
  <Subtype><xsl:value-of select="entry[@ucmdb=$CIT]/@sm"/></Subtype>
</xsl:for-each>

Tip For more information about XSL transformations, visit the following site: http://www.w3schools.com/xsl/