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 toData Flow Management>Adapter Management.ServiceManagerAdapter9-x>
Configuration Files.
3. Click theCreate new resourcebutton . 4. SelectNew Configuration File.
5. Enter a name for the file. The file name should use this format: <AdapterID>/<filename>. For example:ServiceManagerAdapter9-x/test_relation_population.xslt.
6. In the Package field, select the adapter name. For example,ServiceManagerAdapter9-x. 7. ClickOK. A file extension warning dialog is displayed.
8. ClickYesto continue.
UCMDB creates the new XSL transformation file in the Configuration Files folder of the adapter. For example,ServiceManagerAdapter9-x > Configuration Files > ServiceManagerAdapter9-x/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. See the following for an example.
Out-of-the-box, thebusinessservice_to_computer_containment_population.xsltfile is as the following:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/Retrievecirelationship1to1ListResponse">
<topology>
<xsl:for-each select="instance">
<xsl:choose>
<xsl:when test="upstreamci.subtype='Infrastructure Service'"> <ci class="infrastructure_service">
<attribute name="name" type="String"><xsl:value-of select=
"upstreamci.logical.name"/></attribute>
<attribute name="sm_id" type="String"><xsl:value-of select="upstreamci.id"/></attribute>
<link direction="outgoing" linkType="containment"> <ci class="node">
<attribute name="name" type="String"><xsl:value- of select= "downstreamci.logical.name"/></attribute> <attribute name="sm_id" type="String"><xsl:value-of select="downstreamci.id"/> </attribute> </ci> </link> </ci> </xsl:when>
<xsl:when test="upstreamci.subtype='Application Service'"> <ci class="business_application">
<attribute name="name" type="String"><xsl:value-of select=
"upstreamci.logical.name"/></attribute>
<attribute name="sm_id" type="String"><xsl:value-of select="upstreamci.id"/></attribute>
<link direction="outgoing" linkType="containment"> <ci class="node">
<attribute name="name" type="String"><xsl:value- of select= "downstreamci.logical.name"/></attribute> <attribute name="sm_id" type="String"><xsl:value-of select="downstreamci.id"/> </attribute> </ci> </link> </ci> </xsl:when> <xsl:otherwise> <ci class="business_service">
<attribute name="name" type="String"><xsl:value-of select=
"upstreamci.logical.name"/></attribute>
<attribute name="sm_id" type="String"><xsl:value-of select="upstreamci.id"/></attribute>
<link direction="outgoing" linkType="containment"> <ci class="node">
<attribute name="name" type="String"><xsl:value- of select= "downstreamci.logical.name"/></attribute> <attribute name="sm_id" type="String"><xsl:value-of select="downstreamci.id"/> </attribute> </ci>
</link> </ci> </xsl:otherwise> </xsl:choose> </xsl:for-each> </topology> </xsl:template> </xsl:stylesheet>
The file becomes an invalid XML file if you change it to the following:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/Retrievecirelationship1to1ListResponse">
<topology>
<xsl:for-each select="instance">
<xsl:choose>
<xsl:when test="upstreamci.subtype='Infrastructure Service'"> <ci class="infrastructure_service">
</xsl:when>
<xsl:when test="upstreamci.subtype='Application Service'"> <ci class="business_application"> </xsl:when> <xsl:otherwise> <ci class="business_service"> </xsl:otherwise> </xsl:choose>
<attribute name="name" type="String"><xsl:value-of select="upstreamci.logical.name"/>
</attribute>
<attribute name="sm_id" type="String"><xsl:value-of select="upstreamci.id"/></attribute>
<link direction="outgoing" linkType="containment"> <ci class="node">
<attribute name="name" type="String"><xsl:value- of select= "downstreamci.logical.name"/></attribute> <attribute name="sm_id" type="String"><xsl:value-of select= "downstreamci.id"/></attribute> </ci> </link> </ci> </xsl:for-each> </topology> </xsl:template> </xsl:stylesheet> 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>'"/> <xsl:variable name="suffix" select="'</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>
<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:
TheSM_CIT_Subtype_list.xmlfile 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>
Thebusiness_service_push.xsltfile 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: