ServiceGrid Article - ParentChild-XSLT

From DocWiki

Jump to: navigation, search

Overview

This first template creates a new ticket and and links it to the existing ticket (now the parent) as a child.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xsl:template match="SD.call">
  <sd.call-xml>
     <xsl:call-template name="CALL"></xsl:call-template>
  </sd.call-xml>
</xsl:template> 
<!-- ====================== CALL - Template ============= -->
 
<xsl:template name="CALL">

<!-- ====================== Create Child Call ============= -->

<call>

   <parentcall.id><xsl:value-of select="ID"></xsl:value-of></parentcall.id>
   <contracts.shortname><xsl:value-of select="Contracts/ShortName"></xsl:value-of></contracts.shortname>
    <contractelements.shortname><xsl:value-of select="ContractElements/ShortName"></xsl:value-of></contractelements.shortname>
 
 <!-- ====================== SPCallID or CustCallID is needed to create a new ticket  ============= --> 

   <calls.spcallid><xsl:value-of select="ID"></xsl:value-of>-<xsl:value-of select="number(NoOfChildCalls)+1"></xsl:value-of></calls.spcallid>

<callstates.shortname>41D</callstates.shortname>

   <calls.description><xsl:value-of select="Description"></xsl:value-of></calls.description>
   <queues1.shortname>DISPO</queues1.shortname>
   <queues3.shortname><xsl:value-of select="QueuesQU3/ShortName"> </xsl:value-of></queues3.shortname>
   <calls.chdshortname><xsl:value-of select="CHDShortName"></xsl:value-of></calls.chdshortname>
   
 <!-- ====================== update Parent Call ============= -->  

   <subcall>
   <calls.remarks>
       <xsl:text>Es wurde ein Child-Call/Folgeeinsatz mit der ID</xsl:text>
       <xsl:value-of select="$abstand"></xsl:value-of>
       <xsl:value-of select="ID"></xsl:value-of>-<xsl:value-of select="number(NoOfChildCalls)+1"></xsl:value-of>
       <xsl:value-of select="$abstand"></xsl:value-of>
       <xsl:text>eröffnet.</xsl:text>
   </calls.remarks>
       <callstates.shortname>50D</callstates.shortname>
       <calls.id><xsl:value-of select="ID"></xsl:value-of></calls.id>
   </subcall>

</call> 
</xsl:template> 
</xsl:stylesheet> 

This second template creates a new ticket and and links it to the existing ticket (now the parent) as a child.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<br><xsl:template match="SD.call">
<br><sd.call-xml>
<br><xsl:choose>
<br><xsl:when test="string-length(ParentCall/ID) != 0">
<br><xsl:attribute name="Send">NO</xsl:attribute>
<br><call></call>
<br></xsl:when>
<br><xsl:otherwise>
<br><xsl:call-template name="CALL"></xsl:call-template>
<br></xsl:otherwise>
<br></xsl:choose>
<br></sd.call-xml>
<br></xsl:template>
<br>
<br><!-- ====================== CALL - Template ============= -->
<br><xsl:template name="CALL">
<br><!-- ====================== Create Problem Call ============= -->
<br><call>
<br><control.usecodedefaults>No</control.usecodedefaults>
<br>&ltcontracts.shortname>Problem</contracts.shortname>
<br><contractelements.shortname>Problem</contractelements.shortname>
<br><calls.custcallid><xsl:value-of select="ID"></xsl:value-of></calls.custcallid>
<br><!-- ====================== Neuer Status!!! ============= -->
<br><callstates.shortname>PRB1</callstates.shortname>
<br><priorities.shortname>
<br><xsl:choose>
<br><xsl:when test="/SD.call/Priorities/ShortName ='Class 1'">01</xsl:when>
<br><xsl:when test="/SD.call/Priorities/ShortName ='Class 2'">02</xsl:when>
<br><xsl:when test="/SD.call/Priorities/ShortName ='Class 3'">03</xsl:when>
<br><xsl:when test="/SD.call/Priorities/ShortName ='Class 4'">03</xsl:when>
<br><xsl:otherwise>03</xsl:otherwise>
<br></xsl:choose>
<br></priorities.shortname>
<br><calls.remarks>
<br><xsl:text>Problem created from Incident</xsl:text><xsl:value-of select="ID"&lgt;</xsl:value-of><xsl:text>.</xsl:text>
<br></calls.remarks><subcall>
<br><calls.id><xsl:value-of select="ID"></xsl:value-of></calls.id>
<br><parentcall.custcallid><xsl:value-of select="ID"></xsl:value-of></parentcall.custcallid>
<br><calls.remarks>Connected to Problem!</calls.remarks>
<br><callstates.shortname>PiP</callstates.shortname>
<br></subcall>
<br></call>
<br></xsl:template>
<br></xsl:stylesheet>



For a complete list of Cisco ServiceGrid Articles, go to the List of Articles page.



Rating: 0.0/5 (0 votes cast)

Personal tools