<?xml version='1.0'?>
<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>

        <!--Definicion de variables globales-->

        <xsl:variable name="orientationpt" select="'PtoT'"/>
		<xsl:variable name="orientationtp" select="'TtoP'"/>
		<xsl:variable name="x" select="0"/>
		<xsl:variable name="y" select="1"/>
        
		
		
<xsl:template match="/">


<workspaceElements>

	
  <generator tool="CPN Tools"
             version="2.9.12"
             format="6"/>

<cpnet>
	<!--Declaracion de las variables globales, en este caso van a ser canales, relojes...-->
		
	<!--Declaracion de las variables globales, en este caso van a ser canales, relojes...-->

			<declaration>
    <globbox>
    
      <block id="ID1412310166">
        <id>Standard priorities</id>
        <ml id="ID1412310255">val P_HIGH = 100;
          <layout>val P_HIGH = 100;</layout>
        </ml>
        <ml id="ID1412310292">val P_NORMAL = 1000;
          <layout>val P_NORMAL = 1000;</layout>
        </ml>
        <ml id="ID1412310322">val P_LOW = 10000;
          <layout>val P_LOW = 10000;</layout>
        </ml>
         <ml id="ID1412310323">val PM = 1;
          <layout>val PM = 1;</layout>
        </ml>
        <ml id="ID1412310325">val PO = 200;
          <layout>val PO = 2;</layout>
        </ml>
         <ml id="ID1412310324">val PI = 3;
          <layout>val PI = 3;</layout>
        </ml>
      </block>
      <block id="ID1">
        <id>Standard declarations</id>
        <color id="ID85042">
          <id>UNIT</id>
          <unit/>
          <layout>colset UNIT = unit;</layout>
        </color>
        <color id="ID3">
          <id>INT</id>
          <int/>
        </color>
        <color id="ID4">
          <id>BOOL</id>
          <bool/>
        </color>
        <color id="ID5">
          <id>STRING</id>
          <string/>
        </color>
       <color id="ID1412331988">
          <id>NO</id>
          <timed/>
          <int/>
          <layout>colset NO=int timed;</layout>
        </color>
    	<xsl:for-each select="//choreography/variableDefinitions/assign/copy"> 
       			
        		<xsl:element name="var">
        		<xsl:attribute name="id"><xsl:value-of select="concat(generate-id(),'1')"/></xsl:attribute>
        		<xsl:element name="type">
        		<xsl:element name="id"><xsl:value-of select="'NO'"/>
        		</xsl:element>
        		</xsl:element>
        		<xsl:element name="id">
        			       <xsl:value-of select="substring-before(substring-after(target/@variable,'('),',,,')"/>              
        		</xsl:element>
        		<xsl:element name="layout">
        			<xsl:value-of select="'var '"/>
        			<xsl:value-of select="substring-before(substring-after(target/@variable,'('),',,,')"/>
        			<xsl:value-of select="':NO;'"/>
        		</xsl:element>	
        	</xsl:element>	
        </xsl:for-each>

        
       
        <ml id="ID1412331480">val MaxInt=11111;
        	<layout>val MaxInt=11111;</layout>
        </ml>
        <ml id="ID1412331481">val e=0;
        	<layout>val e=0;</layout>
        </ml>
        
       	<xsl:for-each select="//choreography/variableDefinitions/assign/copy"> 
        	<xsl:element name="ml">
        		<xsl:attribute name="id"><xsl:value-of select="concat(generate-id(),'8')"/></xsl:attribute>
        			<xsl:value-of select="'val '"/>
        			<xsl:value-of select="concat('m',substring-before(substring-after(target/@variable,'('),',,,'))"/>
        			<xsl:value-of select="'='"/>
        			<xsl:value-of select="source/@duration"/>
        			<xsl:value-of select="';'"/>
        		<xsl:element name="layout">
        		 	<xsl:value-of select="'val '"/>
        			<xsl:value-of select="concat('m',substring-before(substring-after(target/@variable,'('),',,,'))"/>
        			<xsl:value-of select="'='"/>
        			<xsl:value-of select="source/@duration"/>
        			<xsl:value-of select="';'"/>
        		</xsl:element>	
        	</xsl:element>	
        </xsl:for-each>
       
	
        
      </block>
      
      	
    </globbox>
   </declaration> 
<page id="ID6">
    
			
		<!--Sólo existe una plantilla principal en el sistema-->
	
					
      <pageattr name="Petri's Net"/>
      
		
			
		<!--Sólo existe una plantilla principal en el sistema-->
		<template>
			
<!--################################Nodos##########################################-->
<xsl:for-each select="//choreography">

	  <!--Siempre existe un place para excepciones-->
	  

	  <xsl:for-each select="child::*">
	     
	  	 <!--################################NoAction##########################################-->
			<xsl:if test="(name()='noAction')">
				<xsl:call-template name="noAct">
				</xsl:call-template>
		 	</xsl:if>
		 	
		 <!--################################Fail##########################################-->
			<xsl:if test="(name()='fail')">
				<xsl:call-template name="fail">
				</xsl:call-template>
		 	</xsl:if>
		 
		 <!--NO HAY ASSIGN AQUÍ PARA NO CONFUNDIR CON LAS ASIGNACIONES INICIALES-->
		 	
		 <!--################################Interaction##########################################-->
			<xsl:if test="(name()='interaction')">
				<xsl:call-template name="int">			   		
				</xsl:call-template>
		 	</xsl:if>
										
		 <!--###############################Workunit##############################################-->
	    	<xsl:if test="(name()='workunit')">
	    		<xsl:call-template name="work">
			   					   		
				</xsl:call-template>
	    	</xsl:if>
	    	
	    <!--###############################Sequence###############################################-->
			<xsl:if test="name()='sequence'">
				<xsl:call-template name="seq">
	                	                
	            </xsl:call-template>
	        </xsl:if>
	        
	    <!--###############################Choice#################################################-->
	        <xsl:if test="name()='choice'">	        	
   				<xsl:call-template name="cho">
   				</xsl:call-template>
   			</xsl:if>
   		
   		<!--###############################Parallel#################################################-->
	        <xsl:if test="name()='parallel'">
   				<xsl:call-template name="par">		
   				</xsl:call-template>
   			</xsl:if>	
   			
	  </xsl:for-each>	  
	  
</xsl:for-each>
<!--################################Fin nodos##########################################-->


<!--################################Transiciones#######################################-->

<xsl:for-each select="//choreography">

	<xsl:for-each select="child::*">	
	
	<!--################################NoAction##########################################-->		
    <xsl:if test="(name()='noAction')">   				
			<xsl:call-template name="noAct_trans"></xsl:call-template>		
    </xsl:if>
    
    <!--################################Fail##########################################-->		
    <xsl:if test="(name()='fail')">   				
			<xsl:call-template name="fail_trans"></xsl:call-template>		
    </xsl:if>
    
    <!--NO HAY ASSIGN AQUÍ PARA NO CONFUNDIR CON LAS ASIGNACIONES INICIALES-->
	
	<!--################################Interaction##########################################-->		
    <xsl:if test="(name()='interaction')">   				
			<xsl:call-template name="inter_trans"></xsl:call-template>		
    </xsl:if>
    
    <!--################################Workunit#############################################-->
    <xsl:if test="name()='workunit'">   			
    	<xsl:call-template name="work_trans">
    	</xsl:call-template>
    </xsl:if>
    
    <!--################################Sequence#############################################-->	 
    <xsl:if test="name()='sequence'">
   		<xsl:call-template name="seq_trans">
   		</xsl:call-template>
   	</xsl:if>
   	
   	<!--###############################choice#################################################-->
   	<xsl:if test="name()='choice'">   		
   		<xsl:call-template name="cho_trans">		   		
   		</xsl:call-template>
   	</xsl:if>
   	
   	<!--###############################PARALLEL#################################################-->
   	<xsl:if test="name()='parallel'">
   		<xsl:call-template name="par_trans">  			
   		</xsl:call-template>
   	</xsl:if>   	
    
 </xsl:for-each>
 
<!--################################Fin transiciones###################################-->

</xsl:for-each>
</template>
</page>

    <fin>
    <instances>
      <instance id="ID2149"
                page="ID6"/>
    </instances>
    <options>
      <option name="outputdirectory">
        <value>
          <text>&lt;same as model&gt;</text>
        </value>
      </option>
      <option name="realtimestamp">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="repavg">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="repciavg">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="repcount">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="repfirstval">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="replastval">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="repmax">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="repmin">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="repssquare">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="repssqdev">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="repstddev">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="repsum">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="repvariance">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="avg">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="ciavg">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="count">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="firstval">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="lastval">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="max">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="min">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="ssquare">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="ssqdev">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="stddev">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="sum">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="variance">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="firstupdate">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="interval">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="lastupdate">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="untimedavg">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="untimedciavg">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="untimedcount">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="untimedfirstval">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="untimedlastval">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="untimedmax">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="untimedmin">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="untimedssquare">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="untimedssqdev">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="untimedstddev">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
      <option name="untimedsum">
        <value>
          <boolean>true</boolean>
        </value>
      </option>
      <option name="untimedvariance">
        <value>
          <boolean>false</boolean>
        </value>
      </option>
    </options>
    <binders>
      <cpnbinder id="ID2222"
                 x="257"
                 y="122"
                 width="600"
                 height="400">
        <sheets>
          <cpnsheet id="ID2215"
                    panx="-6.000000"
                    pany="-5.000000"
                    zoom="1.000000"
                    instance="ID2149">
            <zorder>
              <position value="0"/>
            </zorder>
          </cpnsheet>
        </sheets>
        <zorder>
          <position value="0"/>
        </zorder>
      </cpnbinder>
    </binders>
    <monitorblock name="Monitors"/>
    <IndexNode expanded="true">
      <IndexNode expanded="false"/>
      <IndexNode expanded="false"/>
      <IndexNode expanded="false">
        <IndexNode expanded="false"/>
        <IndexNode expanded="false"/>
        <IndexNode expanded="false">
          <IndexNode expanded="false">
            <IndexNode expanded="false">
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
            </IndexNode>
            <IndexNode expanded="false">
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
              <IndexNode expanded="false"/>
            </IndexNode>
          </IndexNode>
          <IndexNode expanded="false">
            <IndexNode expanded="false"/>
            <IndexNode expanded="false"/>
            <IndexNode expanded="false"/>
            <IndexNode expanded="false"/>
            <IndexNode expanded="false"/>
            <IndexNode expanded="false"/>
            <IndexNode expanded="false"/>
            <IndexNode expanded="false"/>
            <IndexNode expanded="false"/>
            <IndexNode expanded="false"/>
            <IndexNode expanded="false"/>
            <IndexNode expanded="false"/>
          </IndexNode>
        </IndexNode>
      </IndexNode>
      <IndexNode expanded="false"/>
      <IndexNode expanded="true">
        <IndexNode expanded="true">
          <IndexNode expanded="true"/>
          <IndexNode expanded="true"/>
          <IndexNode expanded="true"/>
        </IndexNode>
        <IndexNode expanded="true">
          <IndexNode expanded="false"/>
          <IndexNode expanded="false"/>
          <IndexNode expanded="false"/>
          <IndexNode expanded="false"/>
        </IndexNode>
      </IndexNode>
      <IndexNode expanded="false"/>
      <IndexNode expanded="true"/>
    </IndexNode>
</fin>

  </cpnet>
 	
</workspaceElements>				


<!--################################Definición de las plantillas para los parallel###################################-->



</xsl:template>


<!--################################Variables##########################################-->

<!--PLANTILLA PARA LAS VARIABLES DE TIPO CANAL-->


<!--PLANTILLA PARA LAS VARIABLES DE TIPO BOOLEANO-->

	
<!--Se define una variable booleana para controlar cada parallel que aparezca en la coreografía-->


<!--PLANTILLA PARA LAS VARIABLES DE TIPO INT-->


<!--PLANTILLA PARA LAS VARIABLES DE TIPO RELOJ-->


<!--################################Fin Variables##########################################-->



<!--################################Location Actividades##########################################-->

<!--PLANTILLA PARA LOS NOACTION-->
<!--Se añade un location de inicio-->
<xsl:template name="noAct">
<xsl:element name="place">
	<xsl:attribute name="id">idInit_NoAction<xsl:value-of select="count(preceding::noAction)"/></xsl:attribute>
        
        <xsl:element name="text">
        <xsl:value-of select="concat('Init_NoAction',count(preceding::noAction))"/>
		<inplace/>
		</xsl:element>          
        <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('Init_NoActiontype',count(preceding::noAction))"/>
        	</xsl:attribute>         
         <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('Init_NoActioninitmark',count(preceding::noAction))"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>




<!--Se añade la transición del noAction-->
	<xsl:element name="trans">
       	<xsl:attribute name="id">idtransnoAct<xsl:value-of select="count(preceding::noAction)"/></xsl:attribute>
       	<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>	
        <intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat('trans_NoAction',count(preceding::noAction))"/>
        </xsl:element>
        <box w="60.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('iidtrans_NoActioncond',count(preceding::noAction))"/></xsl:attribute>         
          <condtrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_NoActiontime',count(preceding::noAction))"/>
        	</xsl:attribute>
          <timetrans/>
          <text tool="CPN Tools"
                version="2.2.0">@+0</text>
        </xsl:element>
        <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_NoActioncode',count(preceding::noAction))"/>
        	</xsl:attribute>
          <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_NoActionchannel',count(preceding::noAction))"/>
        	</xsl:attribute>
          <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
   
	  <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_NoActionpriority',count(preceding::noAction))" /></xsl:attribute>
        
          <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'PI'"/>
          </xsl:element>         
         </xsl:element> 
	 </xsl:element>	
	 <!--Se añade un location de finalizacion-->
<xsl:element name="place">
	<xsl:attribute name="id">idEnd_NoAction<xsl:value-of select="count(preceding::noAction)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('End_NoAction',count(preceding::noAction))"/>
		</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idEnd_NoActiontype',count(preceding::noAction))"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idEnd_NoActioninitmark',count(preceding::noAction))"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>	

</xsl:template>

<!--PLANTILLA PARA LOS FAIL-->
<xsl:template name="fail">



</xsl:template>

<!--PLANTILLA PARA LOS ASSIGN-->
<xsl:template name="assign">

<!--Se añade un place de inicio-->
<xsl:element name="place">
	<xsl:attribute name="id">idInit_Assign<xsl:value-of select="count(preceding::assign)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('Init_Assign',count(preceding::assign))"/>
	</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idInit_Assigntype',count(preceding::assign))"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idInit_Assigninitmark',count(preceding::assign))"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>
	
<!--place de intercambio valores-->
	<xsl:element name="place">
	<xsl:attribute name="id">idplace1_Assign<xsl:value-of select="count(preceding::assign)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="copy/@name"/><xsl:value-of select="count(preceding::assign)"/>
		</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idplace1_Assigntype',count(preceding::assign))"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idplace1_Assigninitmark',count(preceding::assign))"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'e'"/></text>
        </xsl:element>
      </xsl:element>
<!--transición-->
	<xsl:element name="trans">
		<xsl:attribute name="id"><xsl:value-of select="'idtrans_Assign'"/>
		<xsl:value-of select="count(preceding::assign)"/></xsl:attribute>
		
		<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>
		<intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat('Assign',count(preceding::assign))"/>
        </xsl:element>  
                
        
        <box w="120.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_Assigncond',count(preceding::assign))"/></xsl:attribute>         
        
          <condtrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	
          	<xsl:if test="parent::*[parent::*[name()='workunit']]  and (count(preceding-sibling::*)=0)">
          	<xsl:value-of select="'['"/>
          		<xsl:value-of select="parent::*/parent::*/@guard"/>
          		<xsl:value-of select="']'"/>
          	</xsl:if>
          	
          	</xsl:element>
        </xsl:element>
       
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_Assigntime',count(preceding::assign))"/></xsl:attribute>
        
         <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="concat($prueba,'@')"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'0')"/>
          	</xsl:element>
         
       	           
          
        </xsl:element>
        
        <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_Assigncode',count(preceding::assign))"/></xsl:attribute>
        
         <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_Assignchannel',count(preceding::assign))"/></xsl:attribute>
        
          <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_Assignpriority',count(preceding::assign))" /></xsl:attribute>
        
          <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'PO'"/>
          </xsl:element>         
         </xsl:element> 
	 </xsl:element>	
	 <xsl:if test="contains(parent::*/parent::*/@guard,'&gt;=') and (count(preceding-sibling::*)=0)">
	 <marca name="guarda"><xsl:value-of select="substring-before(parent::*/parent::*/@guard,'&gt;=')"/>
	 <xsl:value-of select="','"/>
	 <xsl:value-of select="substring-after(parent::*/parent::*/@guard,'&gt;=')"/>
	 </marca>
	 </xsl:if>
	 
	 <xsl:if test="ancestor::workunit and (count(preceding-sibling::*)=0)">
	<!--copio la transicion del assign-->
	<xsl:element name="trans">
		<xsl:attribute name="id">idtrans_Assigncopy<xsl:value-of select="count(preceding::assign)"/></xsl:attribute>
		
		<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>
		<intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat('Assign1',count(preceding::assign))"/>
        </xsl:element>  
        <box w="120.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_Assign1cond',count(preceding::assign))"/></xsl:attribute>         
        
          <condtrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          
          	<xsl:if test="parent::*[parent::*[name()='workunit']]">
          		<xsl:value-of select="'['"/>
          		<xsl:if test="contains(parent::*/parent::*/@repeat,'!=')">
          		<xsl:value-of select="substring-before(parent::*/parent::*/@repeat,'!=')"/>
          		<xsl:value-of select="'&lt;&gt;'"/>
          		<xsl:value-of select="substring-after(parent::*/parent::*/@repeat,'!=')"/>
          		</xsl:if>
          		<xsl:value-of select="']'"/>
          	</xsl:if>
          	
          	</xsl:element>
        </xsl:element>
        
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_Assign1time',count(preceding::assign))"/></xsl:attribute>
         <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="concat($prueba,'@')"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'0')"/>
          	</xsl:element>
        </xsl:element>
        <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_Assign1code',count(preceding::assign))"/></xsl:attribute>
         <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_Assign1channel',count(preceding::assign))"/></xsl:attribute>
        
          <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtrans_Assign1priority',count(preceding::assign))" /></xsl:attribute>
        
          <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'PO'"/>
          </xsl:element>         
         </xsl:element> 
	 </xsl:element>	
	 <xsl:if test="contains(parent::*/parent::*/@repeat,'!=')">	
	 <marca name="repeat">
	 <xsl:value-of select="substring-before(parent::*/parent::*/@repeat,'!=')"/>
	 <xsl:value-of select="','"/>
	 <xsl:value-of select="substring-after(parent::*/parent::*/@repeat,'!=')"/>
	 </marca>
	 </xsl:if>
	 <!--arco idplace1_Assign->transcopy-->
	 <xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1assigntranscopy',count(preceding::assign))"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
	        <xsl:element name="placeend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1_Assign',count(preceding::assign))"/></xsl:attribute>
	        </xsl:element>
	        <xsl:element name="transend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtrans_Assigncopy',count(preceding::assign))"/></xsl:attribute>
	        </xsl:element>        
	        <xsl:element name="annot">
	        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1assigntranscopyannot',count(preceding::assign))"/></xsl:attribute>
	       <endarc/>
	       <xsl:if test="not(ancestor::workunit)">
	          <text tool="CPN Tools"
	                version="2.2.0">
	          <xsl:value-of select="substring-before(substring-after(copy/target/@variable,'('),',,,')"/></text>
	       </xsl:if>
	        <xsl:if test="(ancestor::workunit)">
	          <text tool="CPN Tools"
	                version="2.2.0">
	          <xsl:value-of select="substring-before(substring-after(copy/target/@variable,'('),'+')"/></text>
	       </xsl:if>
	        </xsl:element> 
	      </xsl:element>
	 
	 <!--arco transcopy->idplace1_Assing-->
	 <xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('idarctranscopyplace1assign',count(preceding::assign))"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
	       
	        <xsl:element name="transend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtrans_Assigncopy',count(preceding::assign))"/></xsl:attribute>
	        </xsl:element> 
	         <xsl:element name="placeend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1_Assign',count(preceding::assign))"/></xsl:attribute>
	        </xsl:element>       
	        <xsl:element name="annot">
	        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctranscopyplace1assignannot',count(preceding::assign))"/></xsl:attribute>
	       <endarc/>
	       <xsl:if test="(ancestor::workunit)">
	          <text tool="CPN Tools"
	                version="2.2.0">
	          <xsl:value-of select="substring-before(substring-after(copy/target/@variable,'('),',,,')"/></text>
	        </xsl:if>
	       <xsl:if test="not(ancestor::workunit)">
	          <text tool="CPN Tools"
	                version="2.2.0">
	          <xsl:value-of select="substring-before(substring-after(copy/target/@variable,'('),',,,')"/></text>
	        </xsl:if>
	        </xsl:element> 
	      </xsl:element>
	 </xsl:if>
	 <!--Se añade un location de finalizacion-->
<xsl:element name="place">
	<xsl:attribute name="id">idEnd_Assign<xsl:value-of select="count(preceding::assign)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('End_Assign',count(preceding::assign))"/>
	</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idEnd_Assigntype',count(preceding::assign))"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idEnd_Assigninitmark',count(preceding::assign))"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>
</xsl:template>

<!--PLANTILLA PARA LAS INTERACCIONES-->
<xsl:template name="int">
		
		<xsl:variable name="timeout" select="normalize-space(substring-before(priority/timeout/@time-to-complete,':'))"/>
		<xsl:variable name="auxreceive"><xsl:value-of select="substring-before(exchange/receive/@variable,',,,tns:')"/></xsl:variable>
      	<xsl:variable name="receive"><xsl:value-of select="substring-after($auxreceive,'(')"/></xsl:variable>
      	<xsl:variable name="auxsend"><xsl:value-of select="substring-before(exchange/send/@variable,',,,tns:')"/></xsl:variable>
      	<xsl:variable name="send"><xsl:value-of select="substring-after($auxsend,'(')"/></xsl:variable>
      	<xsl:variable name="auxnumsend"><xsl:value-of select="substring-after(exchange/send/@variable,',,,tns:')"/></xsl:variable>
      	<xsl:variable name="numsend"><xsl:value-of select="substring-before($auxnumsend,')')"/></xsl:variable>
      	<xsl:variable name="auxnumreceive"><xsl:value-of select="substring-after(exchange/receive/@variable,',,,tns:')"/></xsl:variable>
      	<xsl:variable name="numreceive"><xsl:value-of select="substring-before($auxnumreceive,')')"/></xsl:variable>
   		
<!--Se añade un place de inicio-->

<xsl:element name="place">
	
	<xsl:attribute name="id">idInit_Interaction<xsl:value-of select="@name"/></xsl:attribute>
	
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('Init_Interaction',@name)"/>
	</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idInit_Interactiontype',@name)"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idInit_Interactioninitmark',@name)"/>
        	</xsl:attribute>
         <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>
      
		
	
		<!--Si existe un timeout -->
		<xsl:if test="priority/timeout">
	
			<xsl:call-template name="aux1"/>
		</xsl:if>
	<xsl:if test="not(priority/timeout)">
		<xsl:element name="trans">
       	<xsl:attribute name="id">idtransint<xsl:value-of select="@name"/></xsl:attribute>
       	<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>	
        <intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat(@name,@name)"/>  
        </xsl:element> 
        <box w="60.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransintcond',@name)"/></xsl:attribute>         
          <condtrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:value-of select="'['"/>
                            <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',,,')"/>
                            <xsl:value-of select="'&lt;&gt;'"/>
                            <xsl:value-of select="'e'"/>
                            <xsl:if test="parent::*/parent::*/parent::*[name()='workunit']">
                           	<xsl:value-of select="','"/>
                           	<xsl:if test="not(contains(parent::*/parent::*/parent::*/@guard,'and')) and contains(parent::*/parent::*/parent::*/@guard,'&lt;')">
                           	<xsl:value-of select="substring-before(parent::*/parent::*/parent::*/@guard,'&lt;')"/>
                           	<xsl:value-of select="'&lt;='"/>
                           	<xsl:value-of select="substring-after(parent::*/parent::*/parent::*/@guard,'&lt;')"/>
                           	</xsl:if>
                           	<xsl:if test="not(//workunit/@guard)">
                           	<xsl:value-of select="'true'"/>
                           	</xsl:if>
                            </xsl:if>
                            <xsl:value-of select="']'"/>
            
          </xsl:element>
        </xsl:element>
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransinttime',@name)"/>
        	</xsl:attribute>
          <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="concat($prueba,'@')"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'discrete(')"/>
          	<xsl:value-of select="concat($prueba,'0')"/>
          	<xsl:value-of select="concat($prueba,',')"/>
          	<xsl:value-of select="concat($prueba,'MaxInt')"/>
          	<xsl:value-of select="concat($prueba,')')"/>
          	</xsl:element>
         
        </xsl:element>
          
          <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransintcode',@name)"/>
        	</xsl:attribute>
         <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransintchannel',@name)"/>
        	</xsl:attribute>
          <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
         <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransintpriority',@name)" /></xsl:attribute>
        
          <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="priority/@value"/>
          </xsl:element>         
         </xsl:element>
   </xsl:element>
  <marca name="guarda">
         <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
         <xsl:value-of select="','"/> 	
         <xsl:if test="contains(parent::*/parent::*/parent::*/@guard,'&lt;')">
			<xsl:value-of select="substring-before(parent::*/parent::*/parent::*/@guard,'&lt;')"/>
		 </xsl:if>
         </marca>	
	</xsl:if>
	
	<xsl:if test="ancestor::workunit and priority/timeout and (count(preceding-sibling::*)=0)">
		<xsl:element name="trans">
       	<xsl:attribute name="id">idtransintcopy2<xsl:value-of select="@name"/></xsl:attribute>
       	<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>	
        <intrans/>
          <xsl:element name="text">
  	    	<xsl:value-of select="concat(@name,@name)"/><xsl:value-of select="'1'"/>
  	</xsl:element>
        <box w="60.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransint2cond',@name)"/></xsl:attribute>         
         <condtrans/>
                 <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:value-of select="'['"/>
                            <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
                            <xsl:value-of select="'&lt;&gt;'"/>
                            <xsl:value-of select="'e'"/>
                            <xsl:value-of select="','"/>
                            <xsl:if test="not(contains(//workunit/@repeat,'=')) and not(contains(//workunit/@repeat,'&lt;&gt;'))">
                            	<xsl:value-of select="'true'"/>
                            </xsl:if>
                            <xsl:if test="contains(//workunit/@repeat,'=')">
                            	<xsl:value-of select="substring-before(substring-after(//workunit/@repeat,'('),',')"/>
                            	<xsl:value-of select="'='"/>
                            	<xsl:value-of select="substring-after(//workunit/@repeat,'=')"/>
                            </xsl:if>
                            <xsl:if test="contains(//workunit/@repeat,'&lt;&gt;')">
                            	<xsl:value-of select="substring-before(substring-after(//workunit/@repeat,'('),',')"/>
                            	<xsl:value-of select="'&lt;&gt;'"/>
                            	<xsl:value-of select="substring-after(//workunit/@repeat,'&lt;&gt;')"/>
                            </xsl:if>
                            
                            <xsl:value-of select="']'"/>
                  </xsl:element>
        </xsl:element>
         
       
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransint2time',@name)"/>
        	</xsl:attribute>
          <timetrans/>
                  <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:variable name="prueba"  select="''"/> 
                            <xsl:value-of select="concat($prueba,'@')"/>
                            <xsl:value-of select="concat($prueba,'+')"/>
                            <xsl:value-of select="concat($prueba,'discrete(')"/>
                            <xsl:value-of select="concat($prueba,'0')"/>
                            <xsl:value-of select="concat($prueba,',')"/>
                            <xsl:value-of select="concat($prueba,$timeout)"/>
                            <xsl:value-of select="concat($prueba,')')"/>
                  </xsl:element>
          
        </xsl:element>
          
          <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransint2code',@name)"/>
        	</xsl:attribute>
          <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransint2channel',@name)"/>
        	</xsl:attribute>
          <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
         <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransint2priority',@name)" /></xsl:attribute>
        <prioritytrans/>
  	          		<xsl:element name="text">
                             <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                             <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                             <xsl:value-of select="priority/@value"/>
                   </xsl:element>     
        </xsl:element>
          	
       </xsl:element> 
       <!--copio fail1-->
  	  
  		<xsl:element name="trans">
       	<xsl:attribute name="id">idfail1int2<xsl:value-of select="@name"/></xsl:attribute>
       	<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>	
        <intrans/>
  	          <xsl:element name="text">
  	                    <xsl:value-of select="concat('fail1int',@name)"/>
  	          </xsl:element>  
  	          
        		
        <box w="60.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail11intcond',@name)"/></xsl:attribute>         
          <condtrans/>
                 <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:value-of select="'['"/>
                            <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
                            <xsl:value-of select="'='"/>
                            <xsl:value-of select="'e'"/>
                            <xsl:value-of select="']'"/>
                  </xsl:element>
          	
          </xsl:element>
       
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail11inttime',@name)"/>
        	</xsl:attribute>
          <timetrans/>
                  <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:variable name="prueba"  select="''"/> 
                            <xsl:value-of select="concat($prueba,'@')"/>
                            <xsl:value-of select="concat($prueba,'+')"/>
                            <xsl:value-of select="concat($prueba,'0')"/>
                  </xsl:element>
                  
          
         
       	           
          
        </xsl:element>
          
          <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail11intcode',@name)"/>
        	</xsl:attribute>
          <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail11intchannel',@name)"/>
        	</xsl:attribute>
          <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
         <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail11intpriority',@name)" /></xsl:attribute>
        <prioritytrans/>
                   <xsl:element name="text">
                             <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                             <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                             <xsl:value-of select="'PM'"/>
                   </xsl:element>         
         </xsl:element> 
                
         </xsl:element>
         <marca name="guarda">
         <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
         </marca>
  	<!--copio timeout-->
  	  
  		<xsl:element name="trans">
       	<xsl:attribute name="id">idtimeoutintcopy<xsl:value-of select="@name"/></xsl:attribute>
       	<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>	
        <intrans/>
  		          <xsl:element name="text">
  		                    <xsl:value-of select="concat('timeout1',@name)"/><xsl:value-of select="'1'"/>  
  		          </xsl:element> 
        		
        <box w="60.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtimeoutintcopycond',@name)"/></xsl:attribute>         
          <condtrans/>
                 <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:value-of select="'['"/>
                            <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
                            <xsl:value-of select="'&lt;&gt;'"/>
                            <xsl:value-of select="'e'"/>
                            <xsl:value-of select="','"/>
                            
                            <xsl:if test="not(contains(//workunit/@repeat,'=')) and not(contains(//workunit/@repeat,'&lt;&gt;'))">
                            	<xsl:value-of select="'true'"/>
                            </xsl:if>
                            <xsl:if test="contains(//workunit/@repeat,'=')">
                            	<xsl:value-of select="substring-before(substring-after(//workunit/@repeat,'('),',')"/>
                            	<xsl:value-of select="'='"/>
                            	<xsl:value-of select="substring-after(//workunit/@repeat,'=')"/>
                            </xsl:if>
                            <xsl:if test="contains(//workunit/@repeat,'&lt;&gt;')">
                            	<xsl:value-of select="substring-before(substring-after(//workunit/@repeat,'('),',')"/>
                            	<xsl:value-of select="'&lt;&gt;'"/>
                            	<xsl:value-of select="substring-after(//workunit/@repeat,'&lt;&gt;')"/>
                            </xsl:if>
                            <xsl:value-of select="']'"/>
                  </xsl:element>
          	
          </xsl:element>
       
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtimeoutintcopytime',@name)"/>
        	</xsl:attribute>
          <timetrans/>
                  <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:variable name="prueba"  select="''"/> 
                            <xsl:value-of select="concat($prueba,'@')"/>
                            <xsl:value-of select="concat($prueba,'+')"/>
                            <xsl:value-of select="concat($prueba,'(')"/>
                            <xsl:value-of select="concat($prueba,$timeout)"/>
                            <xsl:value-of select="concat($prueba,'+')"/>
                            <xsl:value-of select="concat($prueba,'1')"/>
                            <xsl:value-of select="concat($prueba,')')"/>
                  </xsl:element>
        </xsl:element>
          
          <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtimeoutintcopycode',@name)"/>
        	</xsl:attribute>
          <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtimeoutintcopychannel',@name)"/>
        	</xsl:attribute>
          <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
         <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtimeoutintcopypriority',@name)" /></xsl:attribute>
        <prioritytrans/>
                   <xsl:element name="text">
                             <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                             <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                             <xsl:value-of select="priority/@value"/>
                   </xsl:element>  
                
         </xsl:element>
         		
	 </xsl:element>
	 <!--hago los arcos-->
	  	<!--arco place1->fail1copy-->
	 	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1fail1copy',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
	        <xsl:element name="placeend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1int',@name)"/></xsl:attribute>
	        </xsl:element>
	        <xsl:element name="transend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfail1int2',@name)"/></xsl:attribute>
	        </xsl:element>        
	        <xsl:element name="annot">
	        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1fail1copyannot',@name)"/></xsl:attribute>
	       <endarc/>
	          <text tool="CPN Tools"
	                version="2.2.0">
	          <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
	        </xsl:element> 
	      </xsl:element>
	      
	       <!--arco fail1copy->place1-->
	 		 <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcfail1copyplace1',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			
		        <inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfail1int2',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1int',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfail1copyplace1annot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
		        </xsl:element> 
		      </xsl:element>
	 <!--arco fail1copy->per-->
	 	 <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcfail1copyperint',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			
		        <inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfail1int2',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idperint',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfail1copyperintannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
		       <!--arco pd->fail2copy-->
	 	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpdfail2copy',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			
		        <inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpdint',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfail2int2',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpdfail2copyannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
	 <!--arco fail2copy->per-->
	 	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcfail2copyper',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			
		        <inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfail2int2',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idperint',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfail2copyperannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
		      <!--arco timeoutcopy->pd-->
	 		<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctimeoutcopypd',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			
		        <inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtimeoutintcopy',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpdint',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctimeoutcopypdannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
		      <!--arco transcopy->pok-->
	 	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpoktranscopy',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			
		        <inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Interaction',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpoktranscopyannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
	 <!--arco transcopy->place1-->
	 	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctransint2place1',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			
		      <inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1int',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransint2place1annot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
		        </xsl:element> 
		      </xsl:element>
	 <!--arco place1->transcopy-->
	 	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1transint2',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			
		        <inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1int',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1transint2annot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
		        </xsl:element> 
		      </xsl:element>
	 <!--arco transcopy->place2-->
	 	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctransint2place2',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			
		        <inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref">
		        	<xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref">
		        	<xsl:value-of select="concat('idplace2int',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransint2place2annot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
		        </xsl:element> 
		      </xsl:element>
	 <!--arco place2->transcopy-->
	 	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace2transint2',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			
		        <inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace2int',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace2transint2annot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		         <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/receive/@variable,'('),',')"/></text>
		        </xsl:element> 
		      </xsl:element>
			<!--aro pokint->timecopy-->
			
			<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpoktimeoutcopyint2',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			
		        <inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Interaction',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtimeoutintcopy',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpoktimeoutcopyint2annot',@name)"/></xsl:attribute>
		         
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
			<!--place2->twokunitpadre-->
			<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace2inttworkunit',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			
		        <inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace2int',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref">idEnd_Workunitt<xsl:value-of select="@name"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace2inttworkunitannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          		<text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/receive/@variable,'('),',')"/></text>
		        </xsl:element> 
		      </xsl:element>
			<!--tworkunitpadre->place2-->
			<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpintimeoutcopyint2',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			
		        <inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref">idEnd_Workunitt<xsl:value-of select="@name"/></xsl:attribute>
		        </xsl:element>   
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace2int',@name)"/></xsl:attribute>
		        </xsl:element>     
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpintimeoutcopyint2annot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          		<text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/receive/@variable,'('),',')"/></text>
		        </xsl:element> 
		      </xsl:element>
			<!--arco place1->timeoutcopy-->
		
	 	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1tiemoutcopy',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		
	        <inarc/>
	        <xsl:element name="placeend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1int',@name)"/></xsl:attribute>
	        </xsl:element>
	        <xsl:element name="transend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtimeoutintcopy',@name)"/></xsl:attribute>
	        </xsl:element>        
	        <xsl:element name="annot">
	        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1tiemoutcopyannot',@name)"/></xsl:attribute>
	         
	          <endarc/>
	          <text tool="CPN Tools"
	                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
	        </xsl:element> 
	      </xsl:element>
			
			<!--arco timeoutcopy->place1-->
		
				<xsl:element name="arc">
				<xsl:attribute name="id"><xsl:value-of select="concat('idarctiemoutcopyplace1',@name)"/></xsl:attribute>
				<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
				<inarc/>
			        <xsl:element name="transend">
			        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtimeoutintcopy',@name)"/></xsl:attribute>
			        </xsl:element>
			        <xsl:element name="placeend">
			        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1int',@name)"/></xsl:attribute>
			        </xsl:element>        
			        <xsl:element name="annot">
			        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctiemoutcopyplace1annot',@name)"/></xsl:attribute>
			         
			         <endarc/>
			          <text tool="CPN Tools"
			                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
			        </xsl:element> 
			      </xsl:element>
			
			<!--arco pok->fail1copy-->
			
			<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpinfail1copyint',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		
		        <inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Interaction',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfail1int2',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpinfail1copyintannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
		      
		      
	</xsl:if>

	<xsl:if test="ancestor::workunit and not(priority/timeout)  and (count(preceding-sibling::*)=0)">
		<xsl:element name="trans">
       	<xsl:attribute name="id">idtransintcopy2<xsl:value-of select="@name"/></xsl:attribute>
       	<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>	
        <intrans/>
          <xsl:element name="text">
  	     <xsl:value-of select="concat(@name,@name)"/><xsl:value-of select="'1'"/>
  	</xsl:element>
        <box w="60.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransint2cond',@name)"/></xsl:attribute>         
          <condtrans/>
                  <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:value-of select="'['"/>
                            <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
                            <xsl:value-of select="'&lt;&gt;'"/>
							<xsl:value-of select="'e'"/>
							<xsl:value-of select="','"/>
							<xsl:if test="contains(parent::*/parent::*/parent::*/@guard,'&lt;')">
								<xsl:value-of select="substring-before(parent::*/parent::*/parent::*/@guard,'&lt;')"/>
								<xsl:value-of select="'&gt;='"/>
								<xsl:value-of select="substring-after(parent::*/parent::*/parent::*/@guard,'&lt;')"/>
							</xsl:if>
                            <xsl:value-of select="']'"/>
                  </xsl:element>
        </xsl:element>
         
       
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransint2time',@name)"/>
        	</xsl:attribute>
          <timetrans/>
                  <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:variable name="prueba"  select="''"/> 
                            <xsl:value-of select="concat($prueba,'@')"/>
                            <xsl:value-of select="concat($prueba,'+')"/>
                            <xsl:value-of select="concat($prueba,'discrete(')"/>
                            <xsl:value-of select="concat($prueba,'0')"/>
                            <xsl:value-of select="concat($prueba,',')"/>
                            <xsl:value-of select="concat($prueba,'MaxInt')"/>
                            <xsl:value-of select="concat($prueba,')')"/>
                  </xsl:element>
          
        </xsl:element>
          
          <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransint2code',@name)"/>
        	</xsl:attribute>
         <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransint2channel',@name)"/>
        	</xsl:attribute>
          <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
         <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransint2priority',@name)" /></xsl:attribute>
        <prioritytrans/>
  	          <xsl:element name="text">
                             <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                             <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                             <xsl:value-of select="priority/@value"/>
                   </xsl:element>
       
        </xsl:element>
          	
       </xsl:element> 	
        <marca name="guarda">
         <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
         <xsl:value-of select="','"/> 	
         <xsl:if test="contains(parent::*/parent::*/parent::*/@guard,'&lt;')">
			<xsl:value-of select="substring-before(parent::*/parent::*/parent::*/@guard,'&lt;')"/>
		 </xsl:if>
         </marca>	
        	
  	<!--creo copia de fail1-->
  	 
  		<xsl:element name="trans">
       	<xsl:attribute name="id">idfail1int2<xsl:value-of select="@name"/></xsl:attribute>
       	<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>	
        <intrans/>
  	          <xsl:element name="text">
  	                    <xsl:value-of select="concat('fail1int',@name)"/>
  	          </xsl:element>  
  	          
        		
        <box w="60.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail11intcond',@name)"/></xsl:attribute>         
          <condtrans/>
                  <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:value-of select="'['"/>
                            <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
                            <xsl:value-of select="'='"/>
                            <xsl:value-of select="'e'"/>
                            <xsl:value-of select="']'"/>
                  </xsl:element>
          	
          </xsl:element>
       
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail11inttime',@name)"/>
        	</xsl:attribute>
          <timetrans/>
                  <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:variable name="prueba"  select="''"/> 
                            <xsl:value-of select="concat($prueba,'@')"/>
                            <xsl:value-of select="concat($prueba,'+')"/>
                            <xsl:value-of select="concat($prueba,'0')"/>
                  </xsl:element>
          
        </xsl:element>
          
          <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail11intcode',@name)"/>
        	</xsl:attribute>
         <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail11intchannel',@name)"/>
        	</xsl:attribute>
          <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
         <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail11intpriority',@name)" /></xsl:attribute>
        
         <prioritytrans/>
                   <xsl:element name="text">
                             <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                             <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                             <xsl:value-of select="'PM'"/>
                   </xsl:element>         
         </xsl:element> 
                
         </xsl:element>
         <marca guarda="guarda">
         	<xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
         </marca>
         <xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('idarcpoktranscopy',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		
	        <inarc/>
	        <xsl:element name="placeend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Interaction',@name)"/></xsl:attribute>
	        </xsl:element>
	        <xsl:element name="transend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
	        </xsl:element>        
	        <xsl:element name="annot">
	        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpoktranscopyannot',@name)"/></xsl:attribute>
	         
	          <endarc/>
	          <text tool="CPN Tools"
	                version="2.2.0"><xsl:value-of select="$x"/></text>
	        </xsl:element> 
	      </xsl:element>
	   <!--arco de place1->transcopy-->
	   <xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1transcopy',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
	        <xsl:element name="placeend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1int',@name)"/></xsl:attribute>
	        </xsl:element>
	        <xsl:element name="transend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
	        </xsl:element>        
	        <xsl:element name="annot">
	        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1transcopyannot',@name)"/></xsl:attribute>
	         
	          <endarc/>
	          <text tool="CPN Tools"
	                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
	        </xsl:element> 
	      </xsl:element>
	   <!--arco de transcopy->place1-->   
  			<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('idarctranscopyplace1',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
	        <xsl:element name="transend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
	        </xsl:element>
	        <xsl:element name="placeend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1int',@name)"/></xsl:attribute>
	        </xsl:element>        
	        <xsl:element name="annot">
	        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctranscopyplace1annot',@name)"/></xsl:attribute>
	         
	          <endarc/>
	          <text tool="CPN Tools"
	                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
	        </xsl:element> 
	      </xsl:element>
	      <!--arco place2->transcopy-->
	      <xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace2transcopy',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
	        <xsl:element name="placeend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace2int',@name)"/></xsl:attribute>
	        </xsl:element>
	        <xsl:element name="transend">
	        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
	        </xsl:element>        
	        <xsl:element name="annot">
	        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace2transcopyannot',@name)"/></xsl:attribute>
	         
	          <endarc/>
	          <text tool="CPN Tools"
	                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/receive/@variable,'('),',')"/></text>
	        </xsl:element> 
	      </xsl:element>
	      
	      <!--arco transcopy->place2-->
	      
	     			<xsl:element name="arc">
						<xsl:attribute name="id"><xsl:value-of select="concat('idarctranscopyplace2',@name)"/></xsl:attribute>
						<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
						<inarc/>
					        <xsl:element name="transend">
					        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
					        </xsl:element>
					        <xsl:element name="placeend">
					        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace2int',@name)"/></xsl:attribute>
					        </xsl:element>        
					        <xsl:element name="annot">
					        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctranscopyplace2annot',@name)"/></xsl:attribute>
					         
					          <endarc/>
					          <text tool="CPN Tools"
					                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
					        </xsl:element> 
					      </xsl:element>
					      
					      <!--arco fail1copy->place1-->
	      
	      	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailcopyplace1',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfail1int2',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1int',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailcopyplace1annot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
		        </xsl:element> 
		      </xsl:element>
	      
	      <!--arco de place1->fail1copy-->
	      
	      	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1failcopy',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1int',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfail1int2',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1failcopyannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
		        </xsl:element> 
		      </xsl:element>
	      <!--arco de fail1copy->per-->
	      
	      	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailcopyper',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfail1int2',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idperint',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailcopyperannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
       
        
        
       
        <!--pok->fail1copy-->
       
			<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpokfail1copy',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Interaction',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfail1int2',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpokfail1copyannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
         	
         
  		
	
	</xsl:if>
	<xsl:if test="ancestor::workunit  and (count(preceding-sibling::*)=0)">
		
		<xsl:if test="contains(parent::*/parent::*/@guard,'and not')">
	
			<!--tbworkunit->pg-->
			<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctbworkpgwork',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
				<inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtbworkunit',@name)"/></xsl:attribute>
		        </xsl:element>
		         <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',@name)"/></xsl:attribute>
		        </xsl:element>       
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctbworkpgworkannot',@name)"/></xsl:attribute>
		         <endarc/>
		                    
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@guard,'('),',,,xsd:')"/></text>
		        </xsl:element> 
		      </xsl:element>
		      
			<!--pg->tbworkunit-->
			<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpgworktbwork',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
				<inarc/>
		        
		         <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',@name)"/></xsl:attribute>
		        </xsl:element> 
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtbworkunit',@name)"/></xsl:attribute>
		        </xsl:element>      
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpgworktbworkannot',@name)"/></xsl:attribute>
		         <endarc/>
		                    
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@guard,'('),',,,xsd:')"/></text>
		        </xsl:element> 
		      </xsl:element>
		      <xsl:element name="place">
			<xsl:attribute name="id">idpg<xsl:value-of select="@name"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('pg',@name)"/>
        </xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idgtype',@name)"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idginitmark',@name)"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0">
                
                <xsl:value-of select="concat('m',substring-before(substring-after(parent::*/parent::*/@guard,'('),',,,xsd:'))"/>
         
                
                </text>
                
        </xsl:element>
	 </xsl:element>
	 </xsl:if>
         	<!--arco de pg->timeoutint-->
         	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpgtimeoutint',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',@name)"/></xsl:attribute>
		        </xsl:element>   
		         <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtimeoutint',@name)"/></xsl:attribute>
		        </xsl:element>     
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpgtimeoutintannot',@name)"/></xsl:attribute>
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@guard,'('),',,,xsd:')"/></text>
		        </xsl:element> 
		       
		      </xsl:element>
         	<!--place timeoutint->pg-->
         	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctimeoutpg',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtimeoutint',@name)"/></xsl:attribute>
		        </xsl:element>    
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',@name)"/></xsl:attribute>
		        </xsl:element>    
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctimeoutpgannot',@name)"/></xsl:attribute>
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@guard,'('),',,,xsd:')"/></text>
		        </xsl:element> 
		   
		      </xsl:element>
		      <!--pg->transint-->
		      <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpgtransint',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',@name)"/></xsl:attribute>
		        </xsl:element>    
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransint',@name)"/></xsl:attribute>
		        </xsl:element>    
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpgtransintannot',@name)"/></xsl:attribute>
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@guard,'('),',,,xsd:')"/></text>
		        </xsl:element> 
		   
		      </xsl:element>
		      <!--transint->pg-->
		      <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctransintpg',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		          
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransint',@name)"/></xsl:attribute>
		        </xsl:element>   
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',@name)"/></xsl:attribute>
		        </xsl:element>   
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransintpgannot',@name)"/></xsl:attribute>
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@guard,'('),',,,xsd:')"/></text>
		        </xsl:element> 
		   
		      </xsl:element>
         	<!--fail1int->pg-->
         	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcfail1intpg',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		        
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfailint1',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfail1intpgannot',@name)"/></xsl:attribute>
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@guard,'('),',,,xsd:')"/></text>
		        </xsl:element> 
		      </xsl:element>
         	<!--pg->fail1int-->
         	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpgfail1int',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
				<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',@name)"/></xsl:attribute>
		        </xsl:element>  
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfailint1',@name)"/></xsl:attribute>
		        </xsl:element>      
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpgfail1intannot',@name)"/></xsl:attribute>
		         <endarc/>
		                    
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@guard,'('),',,,xsd:')"/></text>
		        </xsl:element> 
		      </xsl:element>
		      <!--end->pg-->
         	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcendguard',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		        
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Workunitt',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcendguardaannot',@name)"/></xsl:attribute>
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@guard,'('),',,,xsd:')"/></text>
		        </xsl:element> 
		      </xsl:element>
         	<!--pg->fail1int-->
         	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcguardaend',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
				<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',@name)"/></xsl:attribute>
		        </xsl:element>  
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Workunitt',@name)"/></xsl:attribute>
		        </xsl:element>      
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcguardaendannot',@name)"/></xsl:attribute>
		         <endarc/>
		                    
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@guard,'('),',,,xsd:')"/></text>
		        </xsl:element> 
		      </xsl:element>
		
		</xsl:if>
         <xsl:if test="ancestor::workunit">	
	<!--arco de pokint->transcopy-->
       <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctranscopypok',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Interaction',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctranscopypokannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element>
		      </xsl:element>
		  </xsl:if>  
		  
		  <xsl:if test="ancestor::workunit and (substring-after(parent::*/parent::*/@repeat,'=')!=0)  and (count(preceding-sibling::*)=0)">
		 
	<!--creo el place del repeat del workunit-->
         <xsl:element name="place">
			<xsl:attribute name="id">idplaceg<xsl:value-of select="@name"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">   
        <xsl:value-of select="concat('g',@name)"/> 
        </xsl:element>      
        <ellipse w="60.000000"
                 h="40.000000"/>
        <token x="-10.000000"
               y="0.000000"/>
        <marking x="0.000000"
                 y="0.000000"
                 hidden="false"/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idplacegtype',@name)"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idplaceginitmark',@name)"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="concat('m',substring-before(substring-after(parent::*/parent::*/@repeat,'('),',,,tns:'))"/></text>
        </xsl:element>
       
	 </xsl:element>
         	<!--arco de transcopy->placeguarda-->
         	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctranscopyplaceg',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplaceg',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctranscopyplacegannot',@name)"/></xsl:attribute>
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@repeat,'('),',,,tns:')"/></text>
		        </xsl:element> 
		      </xsl:element>
		     
         	<!--place guarda->transcopy-->
         	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcplacegtranscopy',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplaceg',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransintcopy2',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplacegtranscopyannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@repeat,'('),',,,tns:')"/></text>
		        </xsl:element> 
		   
		      </xsl:element>
         	<!--placeguarda->tworkunit-->
         	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcplacegtworkunit',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplaceg',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Workunitt',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpgtworkunitannot',@name)"/></xsl:attribute>
		         
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@repeat,'('),',,,tns:')"/></text>
		        </xsl:element> 
		      </xsl:element>
         	<!--tworkunit->placeguarda-->
         	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctworkunitplaceg',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Workunitt',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplaceg',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctworkunitplacegannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@repeat,'('),',,,tns:')"/></text>
		        </xsl:element> 
		      </xsl:element>
		      <!--arco timeoutcopy->g-->
		      
		      	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctimeoutcopygint',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtimeoutintcopy',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplaceg',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctimeoutcopygintannot',@name)"/></xsl:attribute>
		         
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@repeat,'('),',,,tns:')"/></text>
		        </xsl:element> 
		      </xsl:element>
		      <!--arco g->timeout-->
		         	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcplacegtimeoutcopy',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplaceg',@name)"/></xsl:attribute>
		        </xsl:element>  
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtimeoutintcopy',@name)"/></xsl:attribute>
		        </xsl:element>      
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplacegtimeoutcopyannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@repeat,'('),',,,tns:')"/></text>
		        </xsl:element> 
		      </xsl:element>
		      
		      <!--creo un fail nuevo-->
		      <xsl:element name="trans">
       	<xsl:attribute name="id">idfailg<xsl:value-of select="@name"/></xsl:attribute>
       	<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>	
       <intrans/>
          <xsl:element name="text">
  	     <xsl:value-of select="concat('failg',@name)"/>
  	</xsl:element>
        <box w="60.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfailgcond',@name)"/></xsl:attribute>         
          <condtrans/>
                  <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:value-of select="'['"/>
                            <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
                            <xsl:value-of select="'='"/>
                            <xsl:value-of select="'e'"/>
                            <xsl:value-of select="','"/>
                            <xsl:if test="not(contains(parent::*/parent::*/@repeat,'=')) and not(contains(parent::*/parent::*/@repeat,'&lt;&gt;'))">
                            	<xsl:value-of select="'true'"/>
                            </xsl:if>
                            <xsl:if test="contains(parent::*/parent::*/@repeat,'=')">
                            	<xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@repeat,'('),',')"/>
                            	<xsl:value-of select="'='"/>
                            	<xsl:value-of select="substring-after(parent::*/parent::*/@repeat,'=')"/>
                            </xsl:if>
                            <xsl:if test="contains(//workunit/@repeat,'&lt;&gt;')">
                            	<xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@repeat,'('),',')"/>
                            	<xsl:value-of select="'&lt;&gt;'"/>
                            	<xsl:value-of select="substring-after(parent::*/parent::*/@repeat,'&lt;&gt;')"/>
                            </xsl:if>
                            
                            <xsl:value-of select="']'"/>
                  </xsl:element>
        </xsl:element>
         
       
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfailgtime',@name)"/>
        	</xsl:attribute>
          <timetrans/>
                  <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            
                  </xsl:element>
          
        </xsl:element>
          
          <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfailgcode',@name)"/>
        	</xsl:attribute>
         <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfailgchannel',@name)"/>
        	</xsl:attribute>
          <channeltrans/>
        </xsl:element>
         <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfailgpriority',@name)" /></xsl:attribute>
        <prioritytrans/>
  	          <xsl:element name="text">
                             <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                             <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                             <xsl:value-of select="priority/@value"/>
                   </xsl:element>
       
        </xsl:element>
          	
       </xsl:element> 
       <!--arco failg->g-->
       	<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailggwork',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfailg',@name)"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplaceg',@name)"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailggworkannot',@name)"/></xsl:attribute>
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@repeat,'('),',,,tns:')"/></text>
		        </xsl:element> 
		      </xsl:element>
		     <!--arco de g->end_workunit-->
		      <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcgend',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplaceg',@name)"/></xsl:attribute>
		        </xsl:element>  
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Workunitt',@name)"/></xsl:attribute>
		        </xsl:element>      
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcgendannot',@name)"/></xsl:attribute>
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@repeat,'('),',,,tns:')"/></text>
		        </xsl:element> 
		      </xsl:element>
		     <!--arco de end_workunit->g--> 
		      <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcendg',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		        
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Workunitt',@name)"/></xsl:attribute>
		        </xsl:element> 
		         <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplaceg',@name)"/></xsl:attribute>
		        </xsl:element>      
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcendgannot',@name)"/></xsl:attribute>
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@repeat,'('),',,,tns:')"/></text>
		        </xsl:element> 
		      </xsl:element>
       <!--arco g->failg-->	
       
       
       <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcgfailgwork',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplaceg',@name)"/></xsl:attribute>
		        </xsl:element>  
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfailg',@name)"/></xsl:attribute>
		        </xsl:element>      
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcgfailgworkannot',@name)"/></xsl:attribute>
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(parent::*/parent::*/@repeat,'('),',,,tns:')"/></text>
		        </xsl:element> 
		      </xsl:element>
		
			<!--arco place1int->failg-->
			<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1intfailg',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1int',@name)"/></xsl:attribute>
		        </xsl:element>  
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfailg',@name)"/></xsl:attribute>
		        </xsl:element>      
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1intfailgannot',@name)"/></xsl:attribute>
		         
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
		        </xsl:element> 
		      </xsl:element>
			<!--arco failg->place1int-->
			
			<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailgplace1int',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfailg',@name)"/></xsl:attribute>
		        </xsl:element>  
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1int',@name)"/></xsl:attribute>
		        </xsl:element>      
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailgplace1intannot',@name)"/></xsl:attribute>
		         
		         <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/></text>
		        </xsl:element> 
		      </xsl:element>
		      <!--arco failg->per-->
		      
		      
			<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailgperint',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfailg',@name)"/></xsl:attribute>
		        </xsl:element>  
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idperint',@name)"/></xsl:attribute>
		        </xsl:element>      
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailgperintannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
		      <!--arco de endinteraction->failg-->
		      
			<xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpokintfailg',@name)"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Interaction',@name)"/></xsl:attribute>
		        </xsl:element> 
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idfailg',@name)"/></xsl:attribute>
		        </xsl:element>       
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpokintfailgannot',@name)"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
		      </xsl:if>
		      
	<!--creo el place de la guarda del workunit-->
         	
		

	<!--se añade el place de error-->
	<xsl:element name="place">
	
	<xsl:attribute name="id">idperint<xsl:value-of select="@name"/></xsl:attribute>
	
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('perint',@name)"/>
	</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idperinttype',@name)"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idperintinitmark',@name)"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>


  

<!--se añade un place1-->
<xsl:element name="place">
		<xsl:attribute name="id">idplace1int<xsl:value-of select="@name"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat(participate/@fromRole,@name)"/>
        </xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idplace1inttype',@name)"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idplaceinitmark',@name)"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'e'"/></text>
        </xsl:element>
      </xsl:element>
      
      

<!--se añade un place2-->
<xsl:element name="place">
	<xsl:attribute name="id">idplace2int<xsl:value-of select="@name"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat(participate/@toRole,@name)"/>
        </xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idplace2inttype',@name)"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idplace2initmark',@name)"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'e'"/></text>
        </xsl:element>
      </xsl:element>
      

<!--se añade un fail1-->
<xsl:element name="trans">
      	
		<xsl:attribute name="id">idfailint1<xsl:value-of select="@name"/></xsl:attribute>
		
		<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>
		<intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat('fail1',@name)"/>
        </xsl:element>  
                
        
        <box w="120.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail1intcond',@name)"/></xsl:attribute>         
        <condtrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'['"/>
          	<xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
          	<xsl:value-of select="'='"/>
          	<xsl:value-of select="'e'"/>
          	<xsl:if test="parent::*[name()='workunit']">
                            <xsl:value-of select="','"/>
                           	<xsl:if test="not(contains(parent::*/@guard,'and')) and (parent::*/@guard)">
                           	<xsl:value-of select="substring-before(substring-after(parent::*/@guard,'('),',,,xsd:')"/>
                           	<xsl:value-of select="'='"/>
                           	<xsl:value-of select="substring-before(substring-after(parent::*/@guard,',,,xsd:'),')')"/>
                           	</xsl:if>
                           	<xsl:if test="parent::*[name()='workunit'] and contains((parent::*/@guard),'and')">
                            
                            <xsl:value-of select="'true'"/>
                           	
                           	</xsl:if>
                            </xsl:if>
          	<xsl:value-of select="']'"/>
          </xsl:element>
        </xsl:element>
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail1inttime',@name)"/></xsl:attribute>
        <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="concat($prueba,'@')"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'0')"/>
          	</xsl:element>
         
       	           
          
        </xsl:element>
        
        <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail1intcode',@name)"/></xsl:attribute>
        
          <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail1intchannel',@name)"/></xsl:attribute>
        <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail1intpriority',@name)" /></xsl:attribute>
       <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'PM'"/>
          </xsl:element>         
         </xsl:element> 
	 </xsl:element>	
	 <marca name="guarda">
	 	<xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
	 </marca>
	 <!--Se añade un place de finalizacion-->
<xsl:element name="place">
		<xsl:attribute name="id">idEnd_Interaction<xsl:value-of select="@name"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('End_Interaction',@name)"/>
	</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idEnd_Interactiontype',@name)"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idEnd_Interactioninitmark',@name)"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>


</xsl:template>

<!--PLANTILLA PARA LOS SEQUENCE-->
<xsl:template name="seq">

<xsl:param name="nombre_proceso"/>

	<!--Marcar comienzo-->
<SEQUENCE>
	
	<!--Para cada uno de los hijos del workunit-->
	<xsl:for-each select="child::*">
			
		<!--######################Si como hijo tiene un NOACTION######################-->
		<xsl:if test="(name()='noAction')">
			<xsl:call-template name="noAct">
			</xsl:call-template>
	 	</xsl:if>
	 	
	 	<!--######################Si como hijo tiene un FAIL######################-->
		<xsl:if test="(name()='fail')">
			<xsl:call-template name="fail">
			</xsl:call-template>
	 	</xsl:if>
	 	
	 	<!--######################Si como hijo tiene un ASSIGN######################-->
			<xsl:if test="(name()='assign')">
				<xsl:call-template name="assign">
				</xsl:call-template>
		 	</xsl:if>									
		
		<!--######################Si como hijo tiene un INTERACTION#####################-->
		<xsl:if test="name()='interaction'">
		  <xsl:call-template name="int">            
          </xsl:call-template>
		</xsl:if>
		
		<!--######################Si como hijo tiene un SEQUENCE######################-->
		<xsl:if test="name()='sequence'">			
			<xsl:call-template name="seq">
                
            </xsl:call-template>									
		</xsl:if>
		
		<!--######################Si como hijo tiene un WORKUNIT#####################-->
		<xsl:if test="name()='workunit'">
		  <xsl:call-template name="work">
            
          </xsl:call-template>
		</xsl:if>	
		
		<!--######################Si como hijo tiene un CHOICE#####################-->
		<xsl:if test="name()='choice'">			
			<xsl:call-template name="cho">
				
			</xsl:call-template>
		</xsl:if>
		
		<!--######################Si como hijo tiene un PARALLEL#####################-->
		<xsl:if test="name()='parallel'">
		  <xsl:call-template name="par">
            
          </xsl:call-template>
		</xsl:if>		
		
		<xsl:text> </xsl:text>

	</xsl:for-each>
		</SEQUENCE>
	<!--Marcar final-->

	
</xsl:template>

<!--PLANTILLA PARA LOS WORKUNIT-->
<xsl:template name="work">


		<xsl:variable name="aux1" select="@guard"/>
		<xsl:variable name="aux2" select="substring-after($aux1,'xsd:')"/>
		<xsl:variable name="min" select="substring-before($aux2,')and')"/>
		<xsl:variable name="aux3" select="@guard"/>
		<xsl:variable name="aux4" select="substring-after($aux3,'and not(')"/>
		<xsl:variable name="aux5" select="substring-after($aux4,'xsd:')"/>
		<xsl:variable name="max" select="substring-before($aux5,'))')"/>
		<xsl:variable name="repeat" select="substring-after(@repeat,'=')"/>
		<xsl:variable name="block" select="@block"/>
		<xsl:variable name="auxvarmin" select="substring-before($aux1,',xsd:')"/>
		<xsl:variable name="varmin" select="substring-after($auxvarmin,'(')"/>
		<xsl:variable name="auxvarmax" select="substring-after($aux1,'and not(')"/>
		<xsl:variable name="auxvarmax2" select="substring-before($auxvarmax,',xsd:')"/>
		<xsl:variable name="varmax" select="substring-after($auxvarmax2,'(')"/>
		<xsl:variable name="auxrepeat" select="substring-after(@repeat,'(')"/>
		<xsl:variable name="varrepeat" select="substring-before($auxrepeat,',')"/>
	
	
		
		<!--Se añade un place de inicio-->
		<xsl:element name="place">
	<xsl:attribute name="id">idInit_Workunit<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('Init_Workunit',count(preceding::workunit)+count(ancestor::workunit))"/>
		</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idpinworkunittype',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>         
         <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idpinworkunitinitmark',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>
      <xsl:if test="contains(@guard,'and')">
<!--placemin workunit-->

<xsl:element name="place">
	<xsl:attribute name="id">idminworkunit<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
      <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('minworkunit',count(preceding::workunit)+count(ancestor::workunit))"/>
        </xsl:element>          
            <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idminworkunittype',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idminworkunitinitmark',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="concat('m',substring-before(substring-after(@guard,'('),',,,xsd'))"/></text>
        </xsl:element>
        
      </xsl:element>
     

<xsl:element name="place">
	<xsl:attribute name="id">idmaxworkunit<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('maxworkunit',count(preceding::workunit)+count(ancestor::workunit))"/>
        </xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idmaxworkunittype',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idmaxworkunitinitmark',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="concat('m',substring-after(substring-before(substring-after(@guard,'and not('),',,,xsd'),'('))"/></text>
         
        </xsl:element>
      </xsl:element>
      <!--transworkunitdelay-->
		
       <xsl:element name="trans">
		<xsl:attribute name="id">idInit_Workunitt<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
		
		<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>
		<intrans/>
        <xsl:element name="text">
		<xsl:value-of select="concat(@name,count(preceding::workunit)+count(ancestor::workunit))"/>

		</xsl:element>  
        <box w="120.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idInit_Workunittcond',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>         
        <condtrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'['"/>
          	<xsl:value-of select="substring-before(substring-after(@guard,'('),',,,xsd:')"/>
          	<xsl:value-of select="'&lt;&gt;'"/>
          	<xsl:value-of select="'e'"/>
          	<xsl:value-of select="','"/>
          	<xsl:value-of select="substring-before(substring-after(substring-after(@guard,'and not('),'('),',,,xsd:')"/>
          	<xsl:value-of select="'&lt;&gt;'"/>
          	<xsl:value-of select="'e'"/>
          	<xsl:value-of select="']'"/>
          </xsl:element>
        </xsl:element>
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('ididInit_Workunitttime',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
        <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="'@'"/>
          	<xsl:value-of select="'+'"/>
          	<xsl:value-of select="'discrete ('"/>
          	<xsl:value-of select="substring-before(substring-after(@guard,'('),',,,xsd:')"/>
          	<xsl:value-of select="','"/>
          	<xsl:value-of select="substring-before(substring-after(substring-after(@guard,'and not('),'('),',,,xsd:')"/>
          	<xsl:value-of select="')'"/>
          	</xsl:element>
         
        </xsl:element>
        
        <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('ididInit_Workunittcode',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
        <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('ididInit_Workunittchannel',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
        <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('ididInit_Workunittpriority',count(preceding::workunit)+count(ancestor::workunit))" /></xsl:attribute>
        <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'PM'"/>
          </xsl:element>         
         </xsl:element> 
	 </xsl:element>	
	 </xsl:if>
	 

	<!--Marcar comienzo-->
	<WORKUNIT>
	
	<!--Para cada uno de los hijos del workunit-->
	<xsl:for-each select="child::*">

		<xsl:attribute name="id"><xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
		<xsl:attribute name="guard"><xsl:value-of select="$aux1"/></xsl:attribute>
		<xsl:attribute name="block"><xsl:value-of select="$block"/></xsl:attribute>
		
		<!--######################Si como hijo tiene un NOACTION######################-->
		<xsl:if test="(name()='noAction')">
			<xsl:call-template name="noAct">
			</xsl:call-template>
	 	</xsl:if>
	 	
	 	<!--######################Si como hijo tiene un FAIL######################-->
		<xsl:if test="(name()='fail')">
			<xsl:call-template name="fail">
			</xsl:call-template>
	 	</xsl:if>
	 	
	 	<!--######################Si como hijo tiene un ASSIGN######################-->
			<xsl:if test="(name()='assign')">
				<xsl:call-template name="assign">
				</xsl:call-template>
		 	</xsl:if>									
		
		<!--######################Si como hijo tiene un INTERACTION#####################-->
		<xsl:if test="name()='interaction'">
		  <xsl:call-template name="int">            
          </xsl:call-template>
		</xsl:if>
		
		<!--######################Si como hijo tiene un SEQUENCE######################-->
		<xsl:if test="name()='sequence'">			
			<xsl:call-template name="seq">
            </xsl:call-template>									
		</xsl:if>
		
		<!--######################Si como hijo tiene un WORKUNIT#####################-->
		<xsl:if test="name()='workunit'">
		  <xsl:call-template name="work">
          </xsl:call-template>
		</xsl:if>	
		
		<!--######################Si como hijo tiene un CHOICE#####################-->
		<xsl:if test="name()='choice'">			
			<xsl:call-template name="cho">
			</xsl:call-template>
		</xsl:if>
		
		<!--######################Si como hijo tiene un PARALLEL#####################-->
		<xsl:if test="name()='parallel'">
		  <xsl:call-template name="par">
          </xsl:call-template>
		</xsl:if>		
		
		<xsl:text> </xsl:text>
	<xsl:attribute name="id"><xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
	</xsl:for-each>
	
	<!--Marcar final-->
	</WORKUNIT>
		
<!--Se añade un place de finalizacion-->

<!-- trans final del workunit-->
<xsl:element name="trans">
		<xsl:attribute name="id">idEnd_Workunitt<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
		
		<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>
		<intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat('tworkunit',count(preceding::workunit)+count(ancestor::workunit))"/>
        </xsl:element>  
                
        
        <box w="120.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransfinalworkunitcond',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>         
        <condtrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'['"/>
          	<xsl:if test="not(parent::*/parent::*/parent::*/@repeat)">
          		<xsl:value-of select="'true'"/>
          		
          	</xsl:if>
          	<xsl:if test="contains(@repeat,'!')">
          	<xsl:value-of select="','"/>
          	<xsl:value-of select="substring-before(@repeat,'!=')"/>
          	<xsl:value-of select="'='"/>
          	<xsl:value-of select="substring-after(@repeat,'!=')"/>
          	</xsl:if>
          	<xsl:if test="contains(@repeat,'=') and not(contains(@repeat,'!'))">
          	<xsl:value-of select="','"/>
          		<xsl:value-of select="substring-before(@repeat,'=')"/>
          		<xsl:value-of select="'&lt;&gt;'"/>
          		<xsl:value-of select="substring-after(@repeat,'=')"/>
          	</xsl:if>
          	<xsl:if test="contains(@repeat,'&gt;')">
          	<xsl:value-of select="','"/>
          		<xsl:value-of select="substring-before(@repeat,'&gt;')"/>
          		<xsl:value-of select="'&gt;'"/>
          		<xsl:value-of select="substring-after(@repeat,'&gt;')"/>
          	</xsl:if>
          	<xsl:if test="contains(@repeat,'!=')">
          	<xsl:value-of select="','"/>
          	<xsl:value-of select="substring-before(@repeat,'!=')"/>
          	<xsl:value-of select="'&gt;'"/>
          	<xsl:value-of select="'0'"/>
          	</xsl:if>
          	<xsl:value-of select="']'"/>
          	
          </xsl:element>
        </xsl:element>
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtworkunittime',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
        <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="concat($prueba,'@')"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'0')"/>
          	</xsl:element>     
          
        </xsl:element>
        
        <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtworkunitcode',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
     <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtworkunitchannel',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
        <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtworkunitpriority',count(preceding::workunit)+count(ancestor::workunit))" /></xsl:attribute>
        <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'PM'"/>
          </xsl:element>         
         </xsl:element> 
	 </xsl:element>	    
	 <xsl:if test="contains(@repeat,'!=')"> 
	<marca name="repeat">
	<xsl:value-of select="substring-before(@repeat,'!=')"/>
	<xsl:value-of select="','"/><xsl:value-of select="substring-after(@repeat,'!=')"/>
	</marca>
	</xsl:if>
<!--place finworkunit-->

<xsl:element name="place">
	<xsl:attribute name="id">idpokworkunit<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('End_Workunit',count(preceding::workunit)+count(ancestor::workunit))"/>
		</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('ididpokworkunittype',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('ididpokworkunitinitmark',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>

	<xsl:if test="@block='false'">
		<!-- crear la transicion tb-->
		
		<xsl:element name="trans">
		<xsl:attribute name="id">idtbworkunit<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
		
		<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>
		<intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat('tbworkunit',count(preceding::workunit)+count(ancestor::workunit))"/>
        </xsl:element>  
        <box w="120.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransblockfalseworkunitcond',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>         
        <condtrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:value-of select="'['"/>
                            <xsl:if test="contains(@guard,'&gt;=')">
                            	<xsl:value-of select="substring-before(@guard,'&gt;')"/>
                            	<xsl:value-of select="'&lt;'"/>
                            	<xsl:value-of select="substring-after(@guard,'&gt;')"/>
                            </xsl:if>
                            <xsl:if test="contains(@guard,'&lt;=')">
                            
                            	<xsl:value-of select="substring-before(@guard,'&lt;')"/>
                            	<xsl:value-of select="'&gt;'"/>
                            	<xsl:value-of select="substring-after(@guard,'&lt;')"/>
                            </xsl:if>
                            <xsl:if test="contains(@guard,'!=')">
                            
                            	<xsl:value-of select="substring-before(@guard,'!=')"/>
                            	<xsl:value-of select="'&lt;&gt;'"/>
                            	<xsl:value-of select="substring-after(@guard,'!=')"/>
                            </xsl:if>
                            <xsl:value-of select="']'"/>
          </xsl:element>	
          	
          </xsl:element>
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransblockfalseworkunittime',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
        <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="concat($prueba,'@')"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'0')"/>
          	</xsl:element>     
          
        </xsl:element>
        
        <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransblockfalseworkunitcode',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
        <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransblockfalseworkunitchannel',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
        <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransblockfalseworkunitpriority',count(preceding::workunit)+count(ancestor::workunit))" /></xsl:attribute>
        
         <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'PM'"/>
          </xsl:element>         
         </xsl:element> 
	 </xsl:element>	
	 <xsl:if test="contains(@guard,'&gt;=')">
	 <marca name="guarda">
	 <xsl:value-of select="substring-before(@guard,'&gt;')"/>
	 <xsl:value-of select="','"/>
	 <xsl:value-of select="substring-after(@guard,'&gt;=')"/>
	 </marca>
	 </xsl:if>
	 <!--arco de tbworkunit->pgworkunit-->
	 <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctbworkpgwork',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
		         
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtbworkunit',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		        </xsl:element>  
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		        </xsl:element>     
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctbworkpokworkannot',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(@guard,'('),',,,')"/></text>
		        </xsl:element> 
		      </xsl:element>
	 			
	 <!--arco de pgworkunit->tbworkunit-->
		     	 <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctbworkpgwork',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
		         
		       
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		        </xsl:element>  
		         <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtbworkunit',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		        </xsl:element>     
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctbworkpokworkannot',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="substring-before(substring-after(@guard,'('),',,,')"/></text>
		        </xsl:element> 
		      </xsl:element>
	<!--arco de pgworkunit->timeoutint-->	
	      <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpgworktimeout',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpg',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		        </xsl:element>  
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtimeoutint',count(preceding::interaction))"/></xsl:attribute>
		        </xsl:element>      
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpgworktimeoutannot',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
		      
	 <!--arco de tbwokunit->pokworkunit-->
	 <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarctbworkpokwork',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtbworkunit',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idpokworkunit',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctbworkpokworkannot',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
		      <!--pin->tbwokunit-->
		      <xsl:element name="arc">
			<xsl:attribute name="id"><xsl:value-of select="concat('idarcpintbwork',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
			<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
			<inarc/>
		        <xsl:element name="placeend">
		        	<xsl:attribute name="idref"></xsl:attribute>
		        </xsl:element>
		        <xsl:element name="transend">
		        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtbworkunit',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		        </xsl:element>        
		        <xsl:element name="annot">
		        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpintbworkannot',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		         
		          <endarc/>
		          <text tool="CPN Tools"
		                version="2.2.0"><xsl:value-of select="$x"/></text>
		        </xsl:element> 
		      </xsl:element>
		      
	 </xsl:if>

</xsl:template>

<!--PLANTILLA PARA LOS CHOICE-->
<xsl:template name="cho">
<!--se añade un error al choice-->
<xsl:element name="place">
	<xsl:attribute name="id">idperchoice<xsl:value-of select="count(preceding::choice)+count(ancestor::choice)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('Per_Choice',count(preceding::choice)+count(ancestor::choice))"/>
	</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idperchoicetype',count(preceding::choice)+count(ancestor::choice))"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idperchoiceinitmark',count(preceding::choice)+count(ancestor::choice))"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>
	<!--se añade un fail de choice-->
	
  			<xsl:if test="not(ancestor::workunit) and not(ancestor::assign)">
  				<xsl:element name="trans">
		
		<xsl:attribute name="id">idfailchoice<xsl:value-of select="count(preceding::choice)+count(ancestor::choice)"/></xsl:attribute>
		
		<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>
		<intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat('failchoice',count(preceding::choice)+count(ancestor::choice))"/>
		</xsl:element>  
        <box w="120.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfailchoicecond',count(preceding::choice)+count(ancestor::choice))"/></xsl:attribute>         
        <condtrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="aux1"></xsl:variable>
          	<xsl:value-of select="concat($aux1,'[')"/>
          	<xsl:for-each select="//descendant::*[name()='choice']/descendant::*[name()='sequence']/descendant::*[name()='workunit']">
          	<xsl:if test="not (contains(@guard,'and not'))">
          		<xsl:value-of select="substring-before(substring-after(@guard,'('),',,,xsd')"/>
          		<xsl:value-of select="'='"/>
          		<xsl:value-of select="substring-before(substring-after(substring-after(@guard,'('),'xsd:'),')')"/>
          		<xsl:value-of select="','"/>
          		</xsl:if>
          		
          	</xsl:for-each>
          	<xsl:for-each select="//descendant::*[name()='choice']/descendant::*[name()='workunit']">
          		<xsl:if test="interaction">
          			<xsl:value-of select="substring-before(substring-after(interaction/exchange/send/@variable,'('),',,,')"/>
          			<xsl:value-of select="'='"/>
          			<xsl:value-of select="'e'"/>
          			<xsl:value-of select="','"/>
          		</xsl:if>
          	</xsl:for-each>
          	<xsl:for-each select="//descendant::*[name()='choice']/descendant::*[name()='sequence']">
          		<xsl:if test="interaction">
          			
          			<xsl:value-of select="substring-before(substring-after(interaction/exchange/send/@variable,'('),',,,')"/>
          			<xsl:value-of select="'='"/>
          			<xsl:value-of select="'e'"/>
          			<xsl:value-of select="','"/>
          		</xsl:if>
          	</xsl:for-each>
          
          	<xsl:value-of select="']'"/>
          	</xsl:element>
        </xsl:element>
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfailchoicetime',count(preceding::choice)+count(ancestor::choice))"/></xsl:attribute>
        <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="concat($prueba,'@')"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'0')"/>
          	</xsl:element>     
          
        </xsl:element>
        
        <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfailchoicecode',count(preceding::choice)+count(ancestor::choice))"/></xsl:attribute>
        <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfailchoicechannel',count(preceding::choice)+count(ancestor::choice))"/></xsl:attribute>
        <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfailchoicepriority',count(preceding::choice)+count(ancestor::choice))" /></xsl:attribute>
        <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'PM'"/>
          </xsl:element>         
         </xsl:element> 
	 </xsl:element>	 

  			</xsl:if>
  	
		



	<!--se añade un place de inicio-->
	<xsl:element name="place">
	<xsl:attribute name="id">idInit_Choice<xsl:value-of select="count(preceding::choice)+count(ancestor::choice)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('Init_Choice',count(preceding::choice)+count(ancestor::choice))"/>
	</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idInit_Choicetype',count(preceding::choice)+count(ancestor::choice))"/>
        	</xsl:attribute>         
         <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idInit_Choiceinitmark',count(preceding::choice)+count(ancestor::choice))"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>
	

<!--Variable con el identificador del choice-->
<xsl:variable name="choice_id" select="count(preceding::choice) + count(ancestor::choice)"/>

<!--Marcar comienzo-->
<CHOICE>

<xsl:for-each select="child::*">
	<xsl:attribute name="id"><xsl:value-of select="$choice_id"/></xsl:attribute>
	<!--Se deja marcado donde empieza cada uno de los hijos-->	
	<CHOICECHILDIN>
		<xsl:attribute name="id"><xsl:value-of select="$choice_id"/></xsl:attribute>
		<xsl:attribute name="hijo"><xsl:value-of select="position()"/></xsl:attribute>
	</CHOICECHILDIN>	
			
	<!--######################Si como hijo tiene un NOACTION######################-->
	<xsl:if test="(name()='noAction')">
		<xsl:call-template name="noAct">
		</xsl:call-template>
 	</xsl:if>
 	
 	<!--######################No puede tener un FAIL como hijo######################-->
	
 	
 	<!--######################Si como hijo tiene un ASSIGN######################-->
		<xsl:if test="(name()='assign')">
			<xsl:call-template name="assign">
			</xsl:call-template>
	 	</xsl:if>									
	
	<!--######################Si como hijo tiene un INTERACTION#####################-->
	<xsl:if test="name()='interaction'">
	  <xsl:call-template name="int">            
      </xsl:call-template>
	</xsl:if>
	
	<!--######################Si como hijo tiene un SEQUENCE######################-->
	<xsl:if test="name()='sequence'">			
		<xsl:call-template name="seq">
        </xsl:call-template>									
	</xsl:if>
	
	<!--######################Si como hijo tiene un WORKUNIT#####################-->
	<xsl:if test="name()='workunit'">
	  <xsl:call-template name="work">
      </xsl:call-template>
	</xsl:if>	
	
	<!--######################No puede tener un CHOICE como hijo#####################-->
	
	
	<!--######################No puede tener un PARALLEL como hijo#####################-->		
	
	<xsl:text> </xsl:text>
		
	<!--Se deja marcado donde acaba cada uno de los hijos-->	
	<CHOICECHILDOUT>
		<xsl:attribute name="id"><xsl:value-of select="$choice_id"/></xsl:attribute>
		<xsl:attribute name="hijo"><xsl:value-of select="position()"/></xsl:attribute>
	</CHOICECHILDOUT>
	
</xsl:for-each>

<!--Marcar final-->
</CHOICE>

<!--Se añade un place de fin-->

<xsl:element name="place">
	<xsl:attribute name="id">idEnd_Choice<xsl:value-of select="count(preceding::choice)+count(ancestor::choice)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('End_Choice',count(preceding::choice)+count(ancestor::choice))"/>
	</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idEnd_Choicetype',count(preceding::choice)+count(ancestor::choice))"/>
        	</xsl:attribute>         
          <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idEnd_Choiceinitmark',count(preceding::choice)+count(ancestor::choice))"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>

</xsl:template>

<!--PLANTILLA PARA LOS PARALLEL-->
<xsl:template name="par">

	<xsl:variable name="id_parallel" select="count(preceding::parallel)+count(ancestor::parallel)"/>
<!--Se añade un place de inicio-->
	<xsl:element name="place">
	<xsl:attribute name="id">idInit_Parallel<xsl:value-of select="count(preceding::parallel)+count(ancestor::parallel)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('Init_Parallel',count(preceding::parallel)+count(ancestor::parallel))"/>
	</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idInit_Paralleltype',count(preceding::parallel)+count(ancestor::parallel))"/>
        	</xsl:attribute>         
         <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idInit_Parallelinitmark',count(preceding::parallel)+count(ancestor::parallel))"/>
        	</xsl:attribute>
        <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>
 <!--se añade la transición de inicio del parallel-->
      
      	<xsl:element name="trans">
		<xsl:attribute name="id">idInit_Parallell<xsl:value-of select="count(preceding::parallel)+count(ancestor::parallel)"/></xsl:attribute>
		
		<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>
		<intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat('t1par',count(preceding::parallel)+count(ancestor::parallel))"/>
		</xsl:element>  
        <box w="120.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idt1parcond',count(preceding::parallel)+count(ancestor::parallel))"/></xsl:attribute>         
        <condtrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          </xsl:element>
        </xsl:element>
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idt1partime',count(preceding::parallel)+count(ancestor::parallel))"/></xsl:attribute>
        <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="concat($prueba,'@')"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'0')"/>
          	</xsl:element>     
          
        </xsl:element>
        
        <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idt1parcode',count(preceding::parallel)+count(ancestor::parallel))"/></xsl:attribute>
        <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idt1parchannel',count(preceding::parallel)+count(ancestor::parallel))"/></xsl:attribute>
        <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idt1parpriority',count(preceding::parallel)+count(ancestor::parallel))" /></xsl:attribute>
        <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'PM'"/>
          </xsl:element>         
         </xsl:element> 
	 </xsl:element>	
	 <xsl:variable name="parallel_id" select="count(preceding::parallel) + count(ancestor::parallel)"/> 
<!--Marcar comienzo-->
<PARALLEL>
<xsl:for-each select="child::*">
		<PARALLELCHILDIN>
			<xsl:attribute name="id"><xsl:value-of select="$id_parallel"/></xsl:attribute>
			<xsl:attribute name="hijo"><xsl:value-of select="position()"/></xsl:attribute>
		</PARALLELCHILDIN>
				
    <!--######################Si como hijo tiene un NOACTION######################-->
	<xsl:if test="(name()='noAction')">
		<xsl:call-template name="noAct">
		</xsl:call-template>
 	</xsl:if>
 	
 	<!--######################Si como hijo tiene un FAIL######################-->
	<xsl:if test="(name()='fail')">
		<xsl:call-template name="fail">
		</xsl:call-template>
 	</xsl:if>
 	
 	<!--######################Si como hijo tiene un ASSIGN######################-->
		<xsl:if test="(name()='assign')">
			<xsl:call-template name="assign">
			</xsl:call-template>
	 	</xsl:if>									
	
	<!--######################Si como hijo tiene un INTERACTION#####################-->
	<xsl:if test="name()='interaction'">
	  <xsl:call-template name="int">            
      </xsl:call-template>
	</xsl:if>
	
	<!--######################Si como hijo tiene un SEQUENCE######################-->
	<xsl:if test="name()='sequence'">			
		<xsl:call-template name="seq">
            
        </xsl:call-template>									
	</xsl:if>
	
	<!--######################Si como hijo tiene un WORKUNIT#####################-->
	<xsl:if test="name()='workunit'">
	  <xsl:call-template name="work">
        
      </xsl:call-template>
	</xsl:if>	
	
	<!--######################No tiene  como hijo  directo un CHOICE#####################-->
	
	
	<!--######################Si como hijo tiene un PARALLEL#####################-->
	<xsl:if test="name()='parallel'">
	  <xsl:call-template name="par"> 
      </xsl:call-template>
	</xsl:if>		
	
	<xsl:text> </xsl:text>
		
	<!--Se deja marcado donde acaba cada uno de los hijos-->	
	<PARALLELCHILDOUT>
			<xsl:attribute name="id"><xsl:value-of select="$id_parallel"/></xsl:attribute>
			<xsl:attribute name="hijo"><xsl:value-of select="position()"/></xsl:attribute>
		</PARALLELCHILDOUT>
</xsl:for-each>

<!--Marcar final-->
</PARALLEL>

<!--se añade la transicon final del parallel-->
		<xsl:element name="trans">
		<xsl:attribute name="id">idEnd_Parallell<xsl:value-of select="count(preceding::parallel)+count(ancestor::parallel)"/></xsl:attribute>
		
		<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>
		<intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat('t2par',count(preceding::parallel)+count(ancestor::parallel))"/>
		</xsl:element>  
                
        
        <box w="120.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idt2parcond',count(preceding::parallel)+count(ancestor::parallel))"/></xsl:attribute>         
        <condtrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          </xsl:element>
        </xsl:element>
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idt2partime',count(preceding::parallel)+count(ancestor::parallel))"/></xsl:attribute>
        <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="concat($prueba,'@')"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'0')"/>
          	</xsl:element>     
          
        </xsl:element>
        
        <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idt2parcode',count(preceding::parallel)+count(ancestor::parallel))"/></xsl:attribute>
        <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idt2parchannel',count(preceding::parallel)+count(ancestor::parallel))"/></xsl:attribute>
        <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idt2parpriority',count(preceding::parallel)+count(ancestor::parallel))" /></xsl:attribute>
        <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'PM'"/>
          </xsl:element>         
         </xsl:element> 
	 </xsl:element>	 
		
      <!--se añade el place per-->
      <xsl:element name="place">
	<xsl:attribute name="id">idper_Parallel<xsl:value-of select="count(preceding::parallel)+count(ancestor::parallel)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('per_Par',count(preceding::parallel)+count(ancestor::parallel))"/>
	</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idper_Paralleltype',count(preceding::parallel)+count(ancestor::parallel))"/>
        	</xsl:attribute>         
         <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idper_Parallelinitmark',count(preceding::parallel)+count(ancestor::parallel))"/>
        	</xsl:attribute>
         <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>
      <!--se añade el place pc-->
      <xsl:element name="place">
	<xsl:attribute name="id">idpc_Parallel<xsl:value-of select="count(preceding::parallel)+count(ancestor::parallel)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('pc',count(preceding::parallel)+count(ancestor::parallel))"/>
	</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idpc_Paralleltype',count(preceding::parallel)+count(ancestor::parallel))"/>
        	</xsl:attribute>         
         <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idpc_Parallelinitmark',count(preceding::parallel)+count(ancestor::parallel))"/>
        	</xsl:attribute>
         <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>

<!--se añade el place de fin del parallel-->
		<xsl:element name="place">
	<xsl:attribute name="id">idEnd_Parallel<xsl:value-of select="count(preceding::parallel)+count(ancestor::parallel)"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('End_Parallel',count(preceding::parallel)+count(ancestor::parallel))"/>
	</xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idEnd_Paralleltype',count(preceding::parallel)+count(ancestor::parallel))"/>
        	</xsl:attribute>         
         <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idEnd_Parallelinitmark',count(preceding::parallel)+count(ancestor::parallel))"/>
        	</xsl:attribute>
         <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>

</xsl:template>

<!--################################Fin Location Actividades##########################################-->






<!--################################Transitions Actividades##########################################-->

<!--PLANTILLA PARA TRANSICIONES DE LOS NOACTION-->
<xsl:template name="noAct_trans">

	
	
	<!--se añade arco pin->trans-->
	<xsl:element name="arc">
	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpintransnoAct',count(preceding::noAction))"/></xsl:attribute>
	<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
	<inarc/>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref"><xsl:value-of select="concat('idInit_NoAction',count(preceding::noAction))"/></xsl:attribute>
        </xsl:element>
        <xsl:element name="transend">
        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtransnoAct',count(preceding::noAction))"/></xsl:attribute>
        </xsl:element>        
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpintransnoActannot',count(preceding::noAction))"/></xsl:attribute>
         
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element> 
      </xsl:element>
      
      <!--arco de la trans->pok-->
      
      <xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarcnoActtranspok',count(preceding::noAction))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="transend">
        	<xsl:attribute name="idref">idtransnoAct<xsl:value-of select="count(preceding::noAction)"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="placeend">
        	<xsl:attribute name="idref">idEnd_NoAction<xsl:value-of select="count(preceding::noAction)"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcnoActtranspokannot',count(preceding::interaction))"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>
	
	
	
</xsl:template>

<!--PLANTILLA PARA TRANSICIONES DE LOS FAIL-->
<xsl:template name="fail_trans">

	
	
</xsl:template>

<!--PLANTILLA PARA TRANSICIONES DE LOS ASSIGN-->
<xsl:template name="assign_trans">

	
	
	<!--arco de pin->trans-->
	<xsl:element name="arc">
	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpintransassign',count(preceding::assign))"/></xsl:attribute>
	<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
	<inarc/>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref"><xsl:value-of select="concat('idInit_Assign',count(preceding::assign))"/></xsl:attribute>
        </xsl:element>
        <xsl:element name="transend">
        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtrans_Assign',count(preceding::assign))"/></xsl:attribute>
        </xsl:element>        
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpintransassignannot',count(preceding::assign))"/></xsl:attribute>
         
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element> 
      </xsl:element>
      	
<!--arco de trans->pok-->
	
<xsl:element name="arc">
	<xsl:attribute name="id"><xsl:value-of select="concat('idarctranspokassign',count(preceding::assign))"/></xsl:attribute>
	<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
        <xsl:element name="transend">
        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtrans_Assign',count(preceding::assign))"/></xsl:attribute>
        </xsl:element>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref"><xsl:value-of select="concat('idEnd_Assign',count(preceding::assign))"/></xsl:attribute>
        </xsl:element>        
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctranspokassignannot',count(preceding::assign))"/></xsl:attribute>
         
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element> 
      </xsl:element>
	
<!--arco de trans->place1-->	
	<xsl:element name="arc">
	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransplace1assign',count(preceding::assign))"/></xsl:attribute>
	<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
	<inarc/>
        <xsl:element name="transend">
        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtrans_Assign',count(preceding::assign))"/></xsl:attribute>
        </xsl:element>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1_Assign',count(preceding::assign))"/></xsl:attribute>
        </xsl:element>        
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransplace1assignannot',count(preceding::assign))"/></xsl:attribute>
         
          <endarc/>
          <xsl:if test="not(ancestor::workunit)">
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="concat('m',substring-before(substring-after(copy/target/@variable,'('),',,,'))"/></text>
        </xsl:if>
        <xsl:if test="(ancestor::workunit) and (ancestor::choice)">
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="concat('m',substring-before(substring-after(copy/target/@variable,'('),',,,'))"/></text>
        </xsl:if>
        <xsl:if test="(ancestor::workunit) and not(ancestor::choice)">
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="substring-before(substring-after(copy/target/@variable,'('),',,,')"/></text>
        </xsl:if>
        </xsl:element> 
      </xsl:element>
      
     	
      
<!--arco de place->trans-->
	<xsl:element name="arc">
	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1transassign',count(preceding::assign))"/></xsl:attribute>
	<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
	<inarc/>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref"><xsl:value-of select="concat('idplace1_Assign',count(preceding::assign))"/></xsl:attribute>
        </xsl:element>
        <xsl:element name="transend">
        	<xsl:attribute name="idref"><xsl:value-of select="concat('idtrans_Assign',count(preceding::assign))"/></xsl:attribute>
        </xsl:element>        
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplace1transassignannot',count(preceding::assign))"/></xsl:attribute>
         
          <endarc/>
          <xsl:if test="not(ancestor::workunit)">
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="substring-before(substring-after(copy/target/@variable,'('),',,,')"/></text>
        </xsl:if>
         <xsl:if test="ancestor::workunit and contains(copy/target/@variable,'+')">
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="substring-before(substring-after(copy/target/@variable,'('),'+')"/></text>
        </xsl:if>
        <xsl:if test="ancestor::workunit and not(contains(copy/target/@variable,'+'))">
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="substring-before(substring-after(copy/target/@variable,'('),',,,')"/></text>
        </xsl:if>
        </xsl:element> 
      </xsl:element>
	
	
</xsl:template>

<!--PLANTILLA PARA TRANSICIONES DE LAS INTERACCIONES-->
<xsl:template name="inter_trans">	
		
		<xsl:variable name="auxreceive"><xsl:value-of select="substring-before(exchange/receive/@variable,',,,tns:')"/></xsl:variable>
      	<xsl:variable name="receive"><xsl:value-of select="substring-after($auxreceive,'(')"/></xsl:variable>
      	<xsl:variable name="auxsend"><xsl:value-of select="substring-before(exchange/send/@variable,',,,tns:')"/></xsl:variable>
      	<xsl:variable name="send"><xsl:value-of select="substring-after($auxsend,'(')"/></xsl:variable>
      	
		
	<!--Si existe un timeout se debe añadir una transición para cuando se exceda el valor-->
	<xsl:if test="priority/timeout">
	
	
		<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arctimeoutpdint',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
	    <xsl:element name="transend">
	        <xsl:attribute name="idref">idtimeoutint<xsl:value-of select="@name"/></xsl:attribute>
	    </xsl:element>	
	    <xsl:element name="placeend">
	        <xsl:attribute name="idref">idpdint<xsl:value-of select="@name"/></xsl:attribute>
	    </xsl:element>	
	     <xsl:element name="annot">
	    	<xsl:attribute name="id"><xsl:value-of select="concat('arctimeoutpdintannont',@name)"/></xsl:attribute>
	   <endarc/>
	     <xsl:element name="text">
	    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
	    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>     
	    	<xsl:value-of select="$x"/>  
	    </xsl:element>	        
	    </xsl:element>	
		</xsl:element>	
	
          	
	 <!--Arco2 pin->timeout-->
	
		<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arcpintimeoutint',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idInit_Interaction<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>
    <xsl:element name="transend">
        <xsl:attribute name="idref">idtimeoutint<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arcpintimeoutintannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>     
    	<xsl:value-of select="$x"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>

     <!--Arco3 pd->fail2-->
     
	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arcpdfail2int',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idpdint<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="transend">
        <xsl:attribute name="idref">idfailint2<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arcpdfail2intannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>   
    	<xsl:value-of select="$x"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>	
	
	  
	 <!--Arco4 fail2->per-->
	
	   
	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arcfail2perint',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
    <xsl:element name="transend">
        <xsl:attribute name="idref">idfailint2<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idperint<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arcfail2perintannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>    
    	<xsl:value-of select="$x"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>  
	
	  
	<!--arco5 timeout->place1-->
	
	  
	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arctimeoutplace1int',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
    <xsl:element name="transend">
        <xsl:attribute name="idref">idtimeoutint<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idplace1int<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arctimeoutplace1annont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>     
    	<xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>  
	
	  

    <!--arco6 place1->timeout-->  
    
	  
    <xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arcplace1timeoutint',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idplace1int<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="transend">
        <xsl:attribute name="idref">idtimeoutint<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arcplace1timeoutintannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>     
    	<xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>  
   	
	  
     
			 
   </xsl:if>
		
		
	
	
	<!--Arco7 pin->trans-->
   	      
	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arcpintransint',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idInit_Interaction<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="transend">
        <xsl:attribute name="idref">idtransint<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arcpintransintannont',@name)"/></xsl:attribute>
   
   <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
    	<xsl:value-of select="$x"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>	
	
	
	  
        
    <!--Arco8 pin->fail1-->
	       
	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arcpinfail1int',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idInit_Interaction<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="transend">
        <xsl:attribute name="idref">idfailint1<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arcpinfail1intannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
    	<xsl:value-of select="$x"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>	
      
	<!--Arco9 trans->pok-->
         
	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arctranspokint',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
    <xsl:element name="transend">
        <xsl:attribute name="idref">idtransint<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idEnd_Interaction<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arctranspokintannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
    	<xsl:value-of select="$x"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>	
	
	
	<!--Arco10 fail1->per-->
	 
	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arcfail1perint',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
    <xsl:element name="transend">
        <xsl:attribute name="idref">idfailint1<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idperint<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arcfail1perintannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>  
    	<xsl:value-of select="$x"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>	
	
	
		<!--Arco11 fail1->place1-->
	 
	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arcfail1place1int',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<xsl:attribute name="order"><xsl:value-of select="'1'"/></xsl:attribute>
	<inarc/>
    <xsl:element name="transend">
        <xsl:attribute name="idref">idfailint1<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idplace1int<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arcfail1place1intannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>    
    	<xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>	
	  
	  
	<!--Arco12 place1->fail1-->
	 
	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arcplace1fail1int',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idplace1int<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="transend">
        <xsl:attribute name="idref">idfailint1<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arcplace1fail1intannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>    
    	<xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>	
	
	
	<!--Arco13 trans->place2-->
	 
	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arctransplace2int',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
    <xsl:element name="transend">
        <xsl:attribute name="idref">idtransint<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idplace2int<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arctransplace2intannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>    
    	<xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>  
	
	<!--Arco14 place2->trans-->
	 
		<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arcplace2transint',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idplace2int<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="transend">
        <xsl:attribute name="idref">idtransint<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arcplace2transintannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>    
    	<xsl:value-of select="substring-before(substring-after(exchange/receive/@variable,'('),',')"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>  
          
    <!--Arco15 place1->trans-->
	 
	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arcplace1transint',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idplace1int<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="transend">
        <xsl:attribute name="idref">idtransint<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arcplace1transintannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>    
    	<xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element>  
	
	
	
	<!--Arco16 trans->place1-->
	
	<xsl:element name="arc">
		<xsl:attribute name="id"><xsl:value-of select="concat('arctransplace1int',@name)"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
    <xsl:element name="transend">
        <xsl:attribute name="idref">idtransint<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
    <xsl:element name="placeend">
        <xsl:attribute name="idref">idplace1int<xsl:value-of select="@name"/></xsl:attribute>
    </xsl:element>	
     <xsl:element name="annot">
    	<xsl:attribute name="id"><xsl:value-of select="concat('arctransplace1intannont',@name)"/></xsl:attribute>
   
    <endarc/>
     <xsl:element name="text">
    	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
    	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>    
    	<xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>  
    </xsl:element>	        
    </xsl:element>	
	</xsl:element> 

	
	
</xsl:template>

<!--PLANTILLA PARA TRANSICIONES DE LOS SEQUENCE-->
<xsl:template name="seq_trans">

	<xsl:param name="nombre_proceso"/>
		
	<xsl:for-each select="child::*">
	
	
     <xsl:if test="(name()='noAction')">   				
			<xsl:call-template name="noAct_trans"></xsl:call-template>		
     </xsl:if>
	
	 <xsl:if test="(name()='fail')">   				
			<xsl:call-template name="fail_trans"></xsl:call-template>		
     </xsl:if>
     
     <xsl:if test="(name()='assign')">   				
			<xsl:call-template name="assign_trans"></xsl:call-template>		
     </xsl:if>

	 <xsl:if test="name()='interaction'">
	    <xsl:call-template name="inter_trans"></xsl:call-template>		 
	 </xsl:if>

	 <xsl:if test="name()='workunit'">
	 	<xsl:call-template name="work_trans">
	 		<xsl:with-param name="nombre_proceso"><xsl:value-of select="$nombre_proceso"/></xsl:with-param>
	 	</xsl:call-template>		 
	 	
	 </xsl:if>
	 
	 <xsl:if test="name()='sequence'">			
		<xsl:call-template name="seq_trans">
        <xsl:with-param name="nombre_proceso"><xsl:value-of select="$nombre_proceso"/></xsl:with-param>    
        </xsl:call-template>									
	 </xsl:if>
	 
	 <xsl:if test="name()='choice'">
	 	<xsl:call-template name="cho_trans">
		 <xsl:with-param name="nombre_proceso"><xsl:value-of select="$nombre_proceso"/></xsl:with-param>	
   		</xsl:call-template>
	 </xsl:if>
	 
	 <xsl:if test="name()='parallel'">
   	 	<xsl:call-template name="par_trans">
   	 	<xsl:with-param name="nombre_proceso"><xsl:value-of select="$nombre_proceso"/></xsl:with-param>	
   	 	</xsl:call-template>
   	 	
   	 </xsl:if>
	 
	</xsl:for-each>
	
</xsl:template>

<!--PLANTILLA PARA TRANSICIONES DE LOS WORKUNIT-->
<xsl:template name="work_trans">
		<xsl:param name="nombre_proceso"/>	
		<xsl:variable name="aux7" select="exchange/send/@variable"/>
		<xsl:variable name="aux8" select="substring-after($aux7,'(')"/>
		<xsl:variable name="aux9" select="substring-before($aux8,'tns')"/>
		<xsl:variable name="r1v1" select="substring-before($aux9,',,,')"/>
		<xsl:variable name="aux10" select="exchange/receive/@variable"/>
		<xsl:variable name="aux11" select="substring-after($aux10,'(')"/>
		<xsl:variable name="aux12" select="substring-before($aux11,'tns')"/>
		<xsl:variable name="r2v2" select="substring-before($aux12,',,,')"/>
		<xsl:variable name="aux13" select="exchange/send/@variable"/>
		<xsl:variable name="aux14" select="substring-after($aux13,'tns:')"/>
		<xsl:variable name="min" select="substring-before($aux14,')')"/>
		<xsl:variable name="aux15" select="exchange/receive/@variable"/>
		<xsl:variable name="aux16" select="substring-after($aux15,'tns:')"/>
		<xsl:variable name="max" select="substring-before($aux16,')')"/>
		<xsl:variable name="priority" select="priority/@value"/>
		<xsl:variable name="transworkunit" select="@name"/>
		<xsl:variable name="aux1change1" select="substring-after(@guard,'(')"/>
		<xsl:variable name="aux2change1" select="substring-before($aux1change1,'and')"/>
		<xsl:variable name="change1" select="substring-before($aux2change1,',xsd:')"/>
		<xsl:variable name="aux1change2" select="substring-after(@guard,'and not(')"/>
		<xsl:variable name="aux2change2" select="substring-before($aux1change2,',xsd:')"/>
		<xsl:variable name="change2" select="substring-after($aux2change2,'(')" />
		
	
	
	<xsl:variable name="repeticion" select="@repeat"/>
	<xsl:variable name="restriccion" select="@guard"/>	
	
	
	<!--Si existe guarda y el workunit no es bloqueante se debe añadir la transición al final con la guarda negada, a no ser que se encuentre dentro de un CHOICE-->
	<xsl:if test="$restriccion!='' and name(parent::*)!='choice' and contains($restriccion,'and')">
	

		
			<!--arco pinworkunit->transworkunit-->
	
     
	<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpintransworkunit',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref">idInit_Workunit<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="transend">
        	<xsl:attribute name="idref">idInit_Workunitt<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpintransworkunitannot',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>

     
<!--arco transworkunit->minworkunit-->

     
<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransminworkunit',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
      <inarc/>
        <xsl:element name="transend">
        	<xsl:attribute name="idref">idInit_Workunitt<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="placeend">
        	<xsl:attribute name="idref">idminworkunit<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransminworkunitannot',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="substring-after(substring-before(@guard,',,,xsd:'),'(')"/></text>
        </xsl:element>
      </xsl:element>

     

<!--arco minworkunit->transworkunit-->

     
<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarcmintransworkunit',count(preceding::workunit))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref">idminworkunit<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="transend">
        	<xsl:attribute name="idref">idInit_Workunitt<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcmintransworkunitannot',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="substring-after(substring-before(@guard,',,,xsd:'),'(')"/></text>
        </xsl:element>
      </xsl:element>

     
<!--arco transworkunit->maxworkunit-->

     
<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransmaxworkunit',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="transend">
        	<xsl:attribute name="idref">idInit_Workunitt<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="placeend">
        	<xsl:attribute name="idref">idmaxworkunit<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransmaxworkunitannot',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>  
         <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="substring-after(substring-before(substring-after(@guard,'and not('),',,,xsd'),'(')"/></text>
        </xsl:element>
      </xsl:element>

     
<!--arco maxworkunit->transworkunit-->

     
<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarcmaxtransworkunit',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref">idmaxworkunit<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="transend">
        	<xsl:attribute name="idref">idInit_Workunitt<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcmaxtransworkunitannot',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="substring-after(substring-before(substring-after(@guard,'and not('),',,,xsd'),'(')"/></text>
        </xsl:element>
      </xsl:element>
     
     
     <!--arco del inicio del workunit trans-> al inico del descendiente-->
<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransworkunitx',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
      <inarc/>
        <xsl:element name="transend">
        	<xsl:attribute name="idref">idInit_Workunitt<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="placeend">
        	<xsl:attribute name="idref"></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransworkunitxannot',count(preceding::workunit)+count(ancestor::workunit))"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
      </xsl:element>
     
     
     
 
	</xsl:if>
			
	
	
	<!--Marcar comienzo-->
	<WORKUNITIN>
		<xsl:attribute name="id"><xsl:value-of select="count(preceding::workunit) + count(ancestor::workunit)"/></xsl:attribute>
		<xsl:attribute name="repeat"><xsl:value-of select="$repeticion"/></xsl:attribute>
		<xsl:attribute name="restriccion"><xsl:value-of select="$restriccion"/></xsl:attribute>
	</WORKUNITIN>
	
	<xsl:for-each select="child::*">
	
	 <xsl:if test="(name()='noAction')">   				
			<xsl:call-template name="noAct_trans"></xsl:call-template>		
     </xsl:if>
	
	 <xsl:if test="(name()='fail')">   				
			<xsl:call-template name="fail_trans"></xsl:call-template>		
     </xsl:if>
     
     <xsl:if test="(name()='assign')">   				
			<xsl:call-template name="assign_trans"></xsl:call-template>		
     </xsl:if>

	 <xsl:if test="name()='interaction'">
	    <xsl:call-template name="inter_trans"></xsl:call-template>		 
	 </xsl:if>

	 <xsl:if test="name()='workunit'">
	 	<xsl:call-template name="work_trans"><xsl:with-param name="nombre_proceso"><xsl:value-of select="$nombre_proceso"/></xsl:with-param>
	 	</xsl:call-template>		 
	 	
	 </xsl:if>
	 
	 <xsl:if test="name()='sequence'">			
		<xsl:call-template name="seq_trans">
            <xsl:with-param name="nombre_proceso"><xsl:value-of select="$nombre_proceso"/></xsl:with-param>
        </xsl:call-template>									
	 </xsl:if>
	 
	 <xsl:if test="name()='choice'">
	 	<xsl:call-template name="cho_trans">
		 	<xsl:with-param name="nombre_proceso"><xsl:value-of select="$nombre_proceso"/></xsl:with-param>
   		</xsl:call-template>
	 </xsl:if>
	 
	 <xsl:if test="name()='parallel'">
   		<xsl:call-template name="par_trans">
   			<xsl:with-param name="nombre_proceso"><xsl:value-of select="$nombre_proceso"/></xsl:with-param>   			
   		</xsl:call-template>
   		
   	</xsl:if>
	 
	</xsl:for-each>
	
	<!--Marcar final-->
	<WORKUNITOUT>
		<xsl:attribute name="id"><xsl:value-of select="count(preceding::workunit) + count(ancestor::workunit)"/></xsl:attribute>
		<xsl:attribute name="repeat"><xsl:value-of select="$repeticion"/></xsl:attribute>
		<xsl:attribute name="restriccion"><xsl:value-of select="$restriccion"/></xsl:attribute>
	</WORKUNITOUT>
	
	
<!--transicion del transfinalworkunit->pokworkunit-->
	
		<xsl:element name="arc">
		
		<xsl:attribute name="id"><xsl:value-of select="concat('idarctransfinalpokworkunit',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
		<inarc/>
        <xsl:element name="transend">
        	<xsl:attribute name="idref">idEnd_Workunitt<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref">idpokworkunit<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>        
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransfinalpokworkunitannot',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
         
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element> 
      </xsl:element>	
		
		
	

		<xsl:element name="arc">
		
		<xsl:attribute name="id"><xsl:value-of select="concat('idarcxpokworkunit',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
		<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
		<inarc/>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref"></xsl:attribute>
        </xsl:element>
        <xsl:element name="transend">
        	<xsl:attribute name="idref">idEnd_Workunitt<xsl:value-of select="count(preceding::workunit)+count(ancestor::workunit)"/></xsl:attribute>
        </xsl:element>        
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcxpokworkuniannot',count(preceding::workunit)+count(ancestor::workunit))"/></xsl:attribute>
         
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element> 
      </xsl:element>	
		
	
			
</xsl:template>

<!--PLANTILLA PARA TRANSICIONES DEL CHOICE-->
<xsl:template name="cho_trans">

	<xsl:param name="nombre_proceso"/>

	<!--Variable con el identificador del choice-->
	<xsl:variable name="choice_id" select="count(preceding::choice) + count(ancestor::choice)"/>	
		<!--arco de init->failchoice-->
		<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpinchoicefail',$choice_id)"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref">idInit_Choice<xsl:value-of select="$choice_id"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="transend">
        	<xsl:attribute name="idref">idfailchoice<xsl:value-of select="$choice_id"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpinchoicefailannot',$choice_id)"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>
      <!--failchoice al perchoice-->
      <xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailper',$choice_id)"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="transend">
        	<xsl:attribute name="idref">idfailchoice<xsl:value-of select="$choice_id"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="placeend">
        	<xsl:attribute name="idref">idperchoice<xsl:value-of select="$choice_id"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailperannot',$choice_id)"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>
	
	
		<!--Transición de Init al primer elemento de cada hijo-->	
				
		
		
     
		<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpinchoicex',$choice_id)"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref">idInit_Choice<xsl:value-of select="$choice_id"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="transend">
        	<xsl:attribute name="idref"></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpinchoicexannot',$choice_id)"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>
      <!--arco failhijox->perchoice-->
      
		
		<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailhijoperchoice',$choice_id)"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="transend">
        	<xsl:attribute name="idref"></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="placeend">
        	<xsl:attribute name="idref">idperchoice<xsl:value-of select="$choice_id"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcfailhijoperchoiceannot',$choice_id)"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>

		
					
		<xsl:for-each select="child::*">
		 <!--Marcar comienzo cada uno de los hijos del choice-->
		 <CHOICECHILDIN>
			<xsl:attribute name="id"><xsl:value-of select="$choice_id"/></xsl:attribute>
			<xsl:attribute name="hijo"><xsl:value-of select="position()"/></xsl:attribute>
		</CHOICECHILDIN>
		 
		 <xsl:if test="(name()='noAction')">   				
			<xsl:call-template name="noAct_trans"></xsl:call-template>		
	     </xsl:if>
		
		 <!--NO PUEDE SER UN FAIL-->
	     
	     <xsl:if test="(name()='assign')">   				
				<xsl:call-template name="assign_trans"></xsl:call-template>		
	     </xsl:if>
	
		 <xsl:if test="name()='interaction'">
		    <xsl:call-template name="inter_trans"></xsl:call-template>		 
		 </xsl:if>
	
		 <xsl:if test="name()='workunit'">
		 	<xsl:call-template name="work_trans"><xsl:with-param name="nombre_proceso"><xsl:value-of select="$nombre_proceso"/></xsl:with-param>
		 	</xsl:call-template>
		 </xsl:if>
		 
		 <xsl:if test="name()='sequence'">			
			<xsl:call-template name="seq_trans">
	            <xsl:with-param name="nombre_proceso"><xsl:value-of select="$nombre_proceso"/></xsl:with-param>
	        </xsl:call-template>									
		 </xsl:if>
		 
		<!--NO PUEDE SER UN CHOICE-->
     	
     	<!--NO PUEDE SER UN PARALLEL-->
     	
	   	 
	   	<!--Marcar final cada uno de los hijos del choice-->
	   	<CHOICECHILDOUT>
		 <xsl:attribute name="id"><xsl:value-of select="$choice_id"/></xsl:attribute>
		 <xsl:attribute name="hijo"><xsl:value-of select="position()"/></xsl:attribute>
		</CHOICECHILDOUT>
		 
		<!--Transición del ultimo elemento de cada hijo al End-->	
		</xsl:for-each>		
		
		
     
		<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransxpokchoice',$choice_id)"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="transend">
        	<xsl:attribute name="idref"></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="placeend">
        	<xsl:attribute name="idref">idEnd_Choice<xsl:value-of select="$choice_id"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctransxpokchoiceannot',$choice_id)"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>
			
					
		
	 
	 
	 		  	 	
</xsl:template>

<!--PLANTILLA PARA TRANSICIONES DEL PARALLEL-->
<xsl:template name="par_trans">
	
	<xsl:param name="nombre_proceso"/>
	<!--arco del place inicial a la transición inicial-->		
		
		<xsl:variable name="id_parallel" select="count(preceding::PARALLEL)+count(ancestor::PARALLEL)"/>	
		
     
		<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpintransparallel',count(preceding::parallel) + count(ancestor::parallel))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref">idInit_Parallel<xsl:value-of select="count(preceding::parallel) + count(ancestor::parallel)"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="transend">
        	<xsl:attribute name="idref">idInit_Parallell<xsl:value-of select="count(preceding::parallel) + count(ancestor::parallel)"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpintransparallelannot',count(preceding::parallel) + count(ancestor::parallel))"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>
	
	<!--arco de la transicon inicial del parallel->pc-->
	<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarct1parpcpar',count(preceding::parallel) + count(ancestor::parallel))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
      	<inarc/>       
         <xsl:element name="transend">
        	<xsl:attribute name="idref">idInit_Parallell<xsl:value-of select="count(preceding::parallel) + count(ancestor::parallel)"/></xsl:attribute>
        </xsl:element>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref">idpc_Parallel<xsl:value-of select="count(preceding::parallel) + count(ancestor::parallel)"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarct1parpcparannot',count(preceding::parallel) + count(ancestor::parallel))"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>
	<!--arco del transicion inicial al primer elemento-->	
	
	
		
		
		<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarctranschoicex',count(preceding::parallel) + count(ancestor::parallel))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="transend">
        	<xsl:attribute name="idref">idInit_Parallell<xsl:value-of select="count(preceding::parallel) + count(ancestor::parallel)"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="placeend">
        	<xsl:attribute name="idref"></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctranschoicexannot',count(preceding::parallel) + count(ancestor::parallel))"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>
		
	
<xsl:for-each select="child::*">
		
		 <!--Marcar comienzo cada uno de los hijos del choice-->
		 <PARALLELCHILDIN>
			<xsl:attribute name="id"><xsl:value-of select="$id_parallel"/></xsl:attribute>
			<xsl:attribute name="hijo"><xsl:value-of select="position()"/></xsl:attribute>
		</PARALLELCHILDIN>
		 
		 <xsl:if test="(name()='noAction')">   				
			<xsl:call-template name="noAct_trans"></xsl:call-template>		
	     </xsl:if>
		
		 <!--NO PUEDE SER UN FAIL-->
	     
	     <xsl:if test="(name()='assign')">   				
				<xsl:call-template name="assign_trans"></xsl:call-template>		
	     </xsl:if>
	
		 <xsl:if test="name()='interaction'">
		    <xsl:call-template name="inter_trans"></xsl:call-template>		 
		 </xsl:if>
	
		 <xsl:if test="name()='workunit'">
		 	<xsl:call-template name="work_trans"><xsl:with-param name="nombre_proceso"><xsl:value-of select="$nombre_proceso"/></xsl:with-param>
		 	</xsl:call-template>
		 </xsl:if>
		 
		 <xsl:if test="name()='sequence'">			
			<xsl:call-template name="seq_trans">
	            <xsl:with-param name="nombre_proceso"><xsl:value-of select="$nombre_proceso"/></xsl:with-param>
	        </xsl:call-template>									
		 </xsl:if>
		 
     
	   	 
	   	<!--Marcar final cada uno de los hijos del choice-->
	   	<PARALLELCHILDOUT>
		 <xsl:attribute name="id"><xsl:value-of select="$id_parallel"/></xsl:attribute>
		 <xsl:attribute name="hijo"><xsl:value-of select="position()"/></xsl:attribute>
		</PARALLELCHILDOUT>
		 
		<!--Transición del ultimo elemento de cada hijo al End-->	
		</xsl:for-each>	
		<!--arco del pc->End_Parallell-->
		<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpcpart2par',count(preceding::parallel) + count(ancestor::parallel))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
      	<inarc/>       
         
        <xsl:element name="placeend">
        	<xsl:attribute name="idref">idpc_Parallel<xsl:value-of select="count(preceding::parallel) + count(ancestor::parallel)"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="transend">
        	<xsl:attribute name="idref">idEnd_Parallell<xsl:value-of select="count(preceding::parallel) + count(ancestor::parallel)"/></xsl:attribute>
        </xsl:element>
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcpcpart2parannot',count(preceding::parallel) + count(ancestor::parallel))"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>	
	<!--arco de la transicon final al place final del parallel-->
	
	<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarctranschoicepokparallel',count(preceding::parallel) + count(ancestor::parallel))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationtp"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="transend">
        	<xsl:attribute name="idref">idEnd_Parallell<xsl:value-of select="count(preceding::parallel) + count(ancestor::parallel)"/></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="placeend">
        	<xsl:attribute name="idref">idEnd_Parallel<xsl:value-of select="count(preceding::parallel) + count(ancestor::parallel)"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarctranschoicepokparallelannot',count(preceding::parallel) + count(ancestor::parallel))"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>
		
	
	<!--arco del último elemento al trans final-->	
	
	
		
		<xsl:element name="arc">
      	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplacext2parallel',count(preceding::parallel) + count(ancestor::parallel))"/></xsl:attribute>
      	<xsl:attribute name="orientation"><xsl:value-of select="$orientationpt"/></xsl:attribute>
      	<inarc/>
        <xsl:element name="placeend">
        	<xsl:attribute name="idref"></xsl:attribute>
        </xsl:element>	           
         <xsl:element name="transend">
        	<xsl:attribute name="idref">idEnd_Parallell<xsl:value-of select="count(preceding::parallel) + count(ancestor::parallel)"/></xsl:attribute>
        </xsl:element>	
        <xsl:element name="annot">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idarcplacext2parallelannot',count(preceding::parallel) + count(ancestor::parallel))"/>
        	</xsl:attribute>  
          <endarc/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="$x"/></text>
        </xsl:element>
      </xsl:element>
		
	
		
			  	 	
</xsl:template>

<!--################################Fin Transitions Actividades##########################################-->
<xsl:template name="aux1">
	<!--transicion interaction-->
		<xsl:element name="trans">
       	<xsl:attribute name="id">idtransint<xsl:value-of select="@name"/></xsl:attribute>
       	<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>	
        <intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat(@name,@name)"/>  
        </xsl:element> 
        <box w="60.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransintcond',@name)"/></xsl:attribute>         
          <condtrans/>
          
          <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:value-of select="'['"/>
                            <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',,,')"/>
                            <xsl:value-of select="'&lt;&gt;'"/>
                            <xsl:value-of select="'e'"/>
                            <xsl:value-of select="','"/>
                            <xsl:if test="ancestor::workunit">
                            <xsl:if test="not(parent::*/parent::*/parent::*/@guard)">
                            	<xsl:value-of select="'true'"/>
                            </xsl:if>
                           	<xsl:if test="(parent::*/parent::*/parent::*/@guard)">
                           	<xsl:if test="not(contains(parent::*/parent::*/parent::*/@guard,'and'))">
                           	<xsl:value-of select="substring-before(parent::*/parent::*/parent::*/@guard,'&lt;')"/>
                           	<xsl:value-of select="'&lt;='"/>
                           	<xsl:value-of select="substring-after(parent::*/parent::*/parent::*/@guard,'&lt;')"/>
                           	</xsl:if>
                           	<xsl:if test="(contains(parent::*/parent::*/parent::*/@guard,'and'))">
                           		
                           			<xsl:value-of select="'true'"/>
                           		</xsl:if>
                           	<xsl:if test="not(parent::*/parent::*/parent::*/@guard)">
                           	<xsl:value-of select="'true'"/>
                           	</xsl:if>
                            </xsl:if>
                            </xsl:if>
                            <xsl:value-of select="']'"/>
                 
          </xsl:element>
        </xsl:element>
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransinttime',@name)"/>
        	</xsl:attribute>
          <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="concat($prueba,'@')"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'discrete(')"/>
          	<xsl:value-of select="concat($prueba,'0')"/>
          	<xsl:value-of select="concat($prueba,',')"/>
          	<xsl:value-of select="concat($prueba,priority/timeout/@time-to-complete)"/>
          	<xsl:value-of select="concat($prueba,')')"/>
          	</xsl:element>
         
       	           
          
        </xsl:element>
          
          <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransintcode',@name)"/>
        	</xsl:attribute>
          <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransintchannel',@name)"/>
        	</xsl:attribute>
          <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
         <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtransintpriority',@name)" /></xsl:attribute>
        
          <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="priority/@value"/>
          </xsl:element>         
         </xsl:element>
      </xsl:element>
      <marca name="guarda">
      <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
      <xsl:if test="(parent::*/parent::*/parent::*/@guard)">
      <xsl:value-of select="','"/>
       <xsl:if test="not(contains(parent::*/parent::*/parent::*/@guard,'and'))">
       <xsl:value-of select="substring-before(parent::*/parent::*/parent::*/@guard,'&lt;')"/>           
      </xsl:if>
      </xsl:if>
      </marca>

		<!--añado un fail2-->
		<xsl:element name="trans">
		<xsl:attribute name="id">idfailint2<xsl:value-of select="@name"/></xsl:attribute>
		
		<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>
		
		<intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat('failint2',@name)"/>
        </xsl:element>  
                
        
        <box w="120.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail2intcond',@name)"/></xsl:attribute>         
        
         <condtrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          </xsl:element>
        </xsl:element>
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail2inttime',@name)"/></xsl:attribute>
        
         <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="concat($prueba,'@')"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'0')"/>
          	</xsl:element>
         
       	           
          
        </xsl:element>
        
        <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail2intcode',@name)"/></xsl:attribute>
        <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail2intchannel',@name)"/></xsl:attribute>
        <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        
        <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idfail2intpriority',@name)" /></xsl:attribute>
        <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="'PM'"/>
          </xsl:element>         
         </xsl:element> 
	 </xsl:element>	
      
      
		<!--añado un timeout-->
		<xsl:element name="trans">
       	<xsl:attribute name="id">idtimeoutint<xsl:value-of select="@name"/></xsl:attribute>
       	<xsl:attribute name="explicit"><xsl:value-of select="'false'"/></xsl:attribute>	
        <intrans/>
        <xsl:element name="text">
        <xsl:value-of select="concat('timeout',@name)"/>  
        </xsl:element> 
        <box w="60.000000"
             h="40.000000"/>
        <binding x="7.200000"
                 y="-3.000000"/>
        <xsl:element name="cond">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtimeoutintcond',@name)"/></xsl:attribute>         
          <condtrans/>
          	 <xsl:element name="text">
                            <xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
                            <xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
                            <xsl:value-of select="'['"/>
                            <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',,,')"/>
                            <xsl:value-of select="'&lt;&gt;'"/>
                            <xsl:value-of select="'e'"/>
                            <xsl:value-of select="','"/>
                            <xsl:if test="ancestor::workunit">
                            <xsl:if test="not(parent::*/parent::*/parent::*/@guard)">
                            	<xsl:value-of select="'true'"/>
                            </xsl:if>
                           	<xsl:if test="(parent::*/parent::*/parent::*/@guard)">
                           	<xsl:if test="not(contains(parent::*/parent::*/parent::*/@guard,'and'))">
                           	<xsl:value-of select="substring-before(parent::*/parent::*/parent::*/@guard,'&lt;')"/>
                           	<xsl:value-of select="'&lt;='"/>
                           	<xsl:value-of select="substring-after(parent::*/parent::*/parent::*/@guard,'&lt;')"/>
                           	</xsl:if>
                           	<xsl:if test="(contains(parent::*/parent::*/parent::*/@guard,'and'))">
                           		
                           			<xsl:value-of select="'true'"/>
                           		</xsl:if>
                           	<xsl:if test="not(parent::*/parent::*/parent::*/@guard)">
                           	<xsl:value-of select="'true'"/>
                           	</xsl:if>
                            </xsl:if>
                            </xsl:if>
                            <xsl:value-of select="']'"/>
                 
          </xsl:element>
          
          
         
        </xsl:element>
        <xsl:element name="time">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtimeoutinttime',@name)"/>
        	</xsl:attribute>
         <timetrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:variable name="prueba"  select="''"/> 
          	<xsl:value-of select="concat($prueba,'@')"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'(')"/>
          	<xsl:value-of select="concat($prueba,priority/timeout/@time-to-complete)"/>
          	<xsl:value-of select="concat($prueba,'+')"/>
          	<xsl:value-of select="concat($prueba,'1')"/>
          	<xsl:value-of select="concat($prueba,')')"/>
          	</xsl:element>
         
       	           
          
        </xsl:element>
          
          <xsl:element name="code">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtimeoutintcode',@name)"/>
        	</xsl:attribute>
          <codetrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
        <xsl:element name="channel">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtimeoutintchannel',@name)"/>
        	</xsl:attribute>
        <channeltrans/>
          <text tool="CPN Tools"
                version="2.2.0"/>
        </xsl:element>
         <xsl:element name="priority">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idtimeoutintpriority',@name)" /></xsl:attribute>
        
          <prioritytrans/>
          <xsl:element name="text">
          	<xsl:attribute name="tool"><xsl:value-of select="'CPN Tools'"/></xsl:attribute>
          	<xsl:attribute name="version"><xsl:value-of select="'2.2.0'"/></xsl:attribute>
          	<xsl:value-of select="priority/@value"/>
          </xsl:element>         
         </xsl:element>
      </xsl:element>
      <marca name="guarda">
      <xsl:value-of select="substring-before(substring-after(exchange/send/@variable,'('),',')"/>
      <xsl:if test="(parent::*/parent::*/parent::*/@guard)">
      <xsl:value-of select="','"/>
       <xsl:if test="not(contains(parent::*/parent::*/parent::*/@guard,'and'))">
       <xsl:value-of select="substring-before(parent::*/parent::*/parent::*/@guard,'&lt;')"/>           
      </xsl:if>
      </xsl:if>
      </marca>
		<!--añado un place cd-->
		<xsl:element name="place">
	<xsl:attribute name="id">idpdint<xsl:value-of select="@name"/></xsl:attribute>
        <inplace/>
        <xsl:element name="text">
        <xsl:value-of select="concat('pdint',@name)"/>
        </xsl:element>          
             <eplace/>
        <xsl:element name="type">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idpdinttype',@name)"/>
        	</xsl:attribute>         
         <mplace/>
          <text tool="CPN Tools"
                version="2.2.0"><xsl:value-of select="'NO'"/></text>
        </xsl:element>
        <xsl:element name="initmark">
        	<xsl:attribute name="id"><xsl:value-of select="concat('idpdintinitmark',@name)"/>
        	</xsl:attribute>
          <endplace/>
          <text tool="CPN Tools"
                version="2.2.0"></text>
        </xsl:element>
	 </xsl:element>
	
	
</xsl:template>





<!--################################Otras plantillas##########################################-->

<!--PLANTILLA PARA LAS GUARDAS DE LAS TRANSICIONES-->


<!--PLANTILLA PARA LAS GUARDAS DE LAS TRANSICIONES ALTERNATIVAS-->






</xsl:stylesheet>