Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Compare] Updated XSLT
[EMF Compare] Updated XSLT [message #608854] Mon, 23 July 2007 15:19
Eclipse UserFriend
Originally posted by: user.domain.invalid

This is a multi-part message in MIME format.
--------------040608010400030607010508
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Gets the details for Associations e.g. target/source, association name etc.

Works for both navigable & non-navigable (ownedEnd) Associations

Adam

--------------040608010400030607010508
Content-Type: text/xml;
name="EMF-DIFF2HTML.xslt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="EMF-DIFF2HTML.xslt"

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:diff="http://www.eclipse.org/emf/compare/diff/1.0"
xmlns:match="http://www.eclipse.org/emf/compare/match/1.0"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:notation="http://www.ibm.com/xtools/1.5.0/Notation"
xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
xmlns:umlnotation="http://www.ibm.com/xtools/1.5.0/Umlnotation">
<xsl:output method="html" version="1.0" encoding="utf-8"
indent="yes" />

<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>


<xsl:template match="diff:ModelInputSnapshot">

<xsl:variable name="date">
<xsl:value-of select="@date" />
</xsl:variable>


<xsl:variable name="SME" select="//subMatchElements[1]" />
<xsl:variable name="LHE" select="$SME/leftElement/@href" />
<xsl:variable name="LHR" select="$SME/rightElement/@href" />



<xsl:variable name="LHD">
<xsl:call-template name="getFN">
<xsl:with-param name="f_string" select="$LHE" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="RHD">
<xsl:call-template name="getFN">
<xsl:with-param name="f_string" select="$LHR" />
</xsl:call-template>

</xsl:variable>


<!-- <xsl:message>
p_file = <xsl:value-of select="$p_file"/>
docFn = <xsl:value-of select="$docFn"/>
xmi_id = <xsl:value-of select="$xmi_id"/>
</xsl:message> -->

<!-- <xsl:message>
date =
<xsl:value-of select="$date" />
</xsl:message> -->

<xsl:call-template name="processDiff">
<xsl:with-param name="p_node" select="diff/ownedElements" />
<xsl:with-param name="date" select="$date" />
<xsl:with-param name="LHD" select="$LHD" />
<xsl:with-param name="RHD" select="$RHD" />
</xsl:call-template>

</xsl:template>



<xsl:template name="processDiff">
<xsl:param name="p_node" />
<xsl:param name="date" />
<xsl:param name="LHD">LHD</xsl:param>
<xsl:param name="RHD">RHD</xsl:param>

<xsl:variable name="Model_Name">
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/subDiffElements[1]/leftParent/@href" />
</xsl:call-template>
</xsl:variable>





<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8"
http-equiv="content-type" />
<title>View of EMF-DIFF</title>
<style type="text/css">
<xsl:comment><![CDATA[
..docTitle{font-size:18.0pt;font-family:Arial;color:darkblue ;font-weight: bold;text-align:center;}
..docSubTitle{font-size:14.0pt;font-family:Arial;color:darkb lue;font-weight: bold;text-align:center;}
..docSubSubTitle{font-size:12.0pt;color:darkblue;font-weight : bold;text-align:left;}
..docBoldBlue{color:darkblue;font-weight: bold;text-align:left;}
..docBlue{color:darkblue;text-align:left;}
..divCenter{text-align:center;}



h1 {
font-size: 24px;
line-height: normal;
font-weight: bold;
background-color: #f0f0f0;
color: #003366;
border-bottom: 1px solid #3c78b5;
padding: 2px;
margin: 36px 0px 4px 0px;
}

td.tableheader{
text-align: left;color:darkblue;
font-weight: normal;
background:#f0f0f0;
padding:0cm 5.4pt 0cm 5.4pt;
font-size:12.0pt;

}
td.W10{width: 10%;text-align:left;font-size:12.0pt;}
td.W20{width: 20%;text-align:left;font-size:12.0pt;}
td.W80{width: 80%;text-align:left;font-size:12.0pt;}

..filler_td{background-color:lightyellow}
body{font-family:Arial;font-size:12.0pt;}

..StdDiv{font-size:12.0pt;}
..Model{color:darkblue;font-weight: bold}

]]>
</xsl:comment>
</style>
</head>
<body>
<div class="divCenter">
<span class="docTitle">XMI Model Comparison</span>
</div>
<h1>
<span class="docSubTitle">Model Information</span>
</h1>
<table style="text-align: left; width: 100%;" border="0"
cellpadding="2" cellspacing="2">
<tbody>

<tr>
<td class="docBoldBlue">Model :</td>
<td class="Model">
<xsl:value-of select="$Model_Name" />
<!--
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/leftParent/@href" />
</xsl:call-template>-->
</td>
</tr>
<tr>
<td class="docBoldBlue">Compared on :</td>
<td>
<xsl:value-of select="$date" />
</td>
</tr>
<tr>
<td class="docBoldBlue">
<xsl:value-of
select="'Left hand Document :'" />
</td>
<td>
<xsl:value-of select="$LHD" />
</td>
</tr>

<tr>
<td class="docBoldBlue">
<xsl:value-of
select="'Right hand Document :'" />
</td>
<td>
<xsl:value-of select="$RHD" />
</td>
</tr>
</tbody>
</table>
<h1>
<span class="docSubTitle">Comparison</span>
</h1>
<table style="text-align: left; width: 100%;" border="0"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<th>
<xsl:value-of select="$Model_Name" />
</th>
<!-- <th>Sub Model Element</th>-->
</tr>

<xsl:for-each
select="$p_node/subDiffElements[@xsi:type != 'diff:DiffGroup']">
<xsl:message>
xsi:type 1 =
<xsl:value-of select="@xsi:type" />
</xsl:message>
<tr>
<xsl:call-template name="subdiff">
<xsl:with-param name="p_node"
select="." />
<xsl:with-param name="counter"
select="'0'" />
</xsl:call-template>
</tr>
</xsl:for-each>

<xsl:for-each
select="$p_node/subDiffElements[@xsi:type = 'diff:DiffGroup']">
<!-- <xsl:message>
xsi:type 2 = <xsl:value-of select="@xsi:type" />
</xsl:message> -->

<xsl:call-template name="subdiff">
<xsl:with-param name="p_node"
select="." />
<xsl:with-param name="counter"
select="'1'" />
</xsl:call-template>

</xsl:for-each>


<!-- <xsl:for-each select="//subDiffElements[@xsi:type='diff:RemoveModelElement'] ">
<tr>
<td ><xsl:value-of select="rightParent/@href"/></td>
<td ><xsl:value-of select="leftElement/@href"/></td>
</tr>
</xsl:for-each> -->
</tbody>
</table>
</body>
</html>

</xsl:template>

<xsl:template name="subdiff">
<xsl:param name="p_node" />
<xsl:param name="counter">0</xsl:param>
<!-- <xsl:message>
type =<xsl:value-of select="$p_node/@xsi:type" />
</xsl:message> -->

<xsl:variable name="diffType">
<xsl:value-of select="$p_node/@xsi:type" />
</xsl:variable>
<xsl:variable name="v_count">
<xsl:value-of select="$counter +1" />
</xsl:variable>

<xsl:choose>
<!-- DiffGroup -->
<xsl:when test="$diffType ='diff:DiffGroup'">
<!-- <xsl:message>
V_count = <xsl:value-of select="$v_count" />
count = <xsl:value-of select="$counter" />
</xsl:message> -->

<tr>
<xsl:if test="$counter > 0">
<xsl:call-template name="print-td">
<xsl:with-param name="count"
select="$counter" />
</xsl:call-template>
</xsl:if>
<td class="DiffGroup">
<xsl:call-template name="changeCounter">
<xsl:with-param name="p_node"
select="$p_node" />
</xsl:call-template>
<xsl:value-of select="' changes in : '" />

<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/leftParent/@href" />
</xsl:call-template>

</td>
</tr>

<xsl:for-each select="$p_node/subDiffElements">

<xsl:call-template name="subdiff">
<xsl:with-param name="p_node" select="." />
<xsl:with-param name="counter"
select="$v_count" />
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<!-- Model Element Changes -->
<xsl:when test="$diffType ='diff:RemoveModelElement'">
<tr>
<xsl:if test="$counter > 0">
<xsl:call-template name="print-td">
<xsl:with-param name="count"
select="$counter" />
</xsl:call-template>
</xsl:if>
<td class="RemoveModelElement">
<xsl:text> Model Element </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/leftElement/@href" />
</xsl:call-template>
<xsl:text> has been removed </xsl:text>
</td>
</tr>
</xsl:when>
<xsl:when test="$diffType ='diff:AddModelElement'">
<tr>
<xsl:if test="$counter > 0">
<xsl:call-template name="print-td">
<xsl:with-param name="count"
select="$counter" />
</xsl:call-template>
</xsl:if>
<td class="AddModelElement">
<xsl:text> Model Element </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/rightElement/@href" />
</xsl:call-template>
<xsl:text> has been added </xsl:text>
</td>
</tr>
</xsl:when>
<xsl:when test="$diffType ='diff:MoveModelElement'">
<tr>
<xsl:if test="$counter > 0">
<xsl:call-template name="print-td">
<xsl:with-param name="count"
select="$counter" />
</xsl:call-template>
</xsl:if>
<td class="MoveModelElement">
<xsl:text> Model Element </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/leftParent/@href" />
</xsl:call-template>
<xsl:text> has been moved </xsl:text>
</td>
</tr>
</xsl:when>
<xsl:when test="$diffType ='diff:UpdateModelElement'">
<tr>
<xsl:if test="$counter > 0">
<xsl:call-template name="print-td">
<xsl:with-param name="count"
select="$counter" />
</xsl:call-template>
</xsl:if>
<td class="UpdateModelElement">
<xsl:text> Model Element has been changed from </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/leftElement/@href" />
</xsl:call-template>
<xsl:text> to </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/rightElement/@href" />
</xsl:call-template>
</td>
</tr>
</xsl:when>
<!-- Attribute Changes -->
<xsl:when test="$diffType ='diff:AddAttribute'">
<tr>
<xsl:if test="$counter > 0">
<xsl:call-template name="print-td">
<xsl:with-param name="count"
select="$counter" />
</xsl:call-template>
</xsl:if>
<td class="AddAttribute">
<xsl:text> Attribute </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/rightElement/@href" />
</xsl:call-template>
<xsl:text> has been added </xsl:text>
</td>
</tr>
</xsl:when>
<xsl:when test="$diffType ='diff:RemoveAttribute'">
<tr>
<xsl:if test="$counter > 0">
<xsl:call-template name="print-td">
<xsl:with-param name="count"
select="$counter" />
</xsl:call-template>
</xsl:if>
<td class="RemoveAttribute">
<xsl:text> Attribute </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/leftElement/@href" />
</xsl:call-template>
<xsl:text> has been removed </xsl:text>
</td>
</tr>
</xsl:when>
<xsl:when test="$diffType ='diff:UpdateAttribute'">
<tr>
<xsl:if test="$counter > 0">
<xsl:call-template name="print-td">
<xsl:with-param name="count"
select="$counter" />
</xsl:call-template>
</xsl:if>
<td class="UpdateAttribute">
<xsl:text> Attribute has been changed from </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/leftElement/@href" />
</xsl:call-template>
<xsl:text> to </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/rightElement/@href" />
</xsl:call-template>
</td>
</tr>
</xsl:when>
<!-- Reference Changes -->
<xsl:when test="$diffType ='diff:AddReferenceValue'">
<tr>
<xsl:if test="$counter > 0">
<xsl:call-template name="print-td">
<xsl:with-param name="count"
select="$counter" />
</xsl:call-template>
</xsl:if>
<td class="AddReferenceValue">
<xsl:text> Reference </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/rightAddedTarget/@href" />
</xsl:call-template>
<xsl:text> has been added </xsl:text>
</td>
</tr>
</xsl:when>
<xsl:when test="$diffType ='diff:RemoveReferenceValue'">
<tr>
<xsl:if test="$counter > 0">
<xsl:call-template name="print-td">
<xsl:with-param name="count"
select="$counter" />
</xsl:call-template>
</xsl:if>
<td class="RemoveReferenceValue">
<xsl:text> Reference </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/leftRemovedTarget/@href" />
</xsl:call-template>
<xsl:text> has been removed </xsl:text>
</td>
</tr>
</xsl:when>
<xsl:when test="$diffType ='diff:UpdateReference'">
<tr>
<xsl:if test="$counter > 0">
<xsl:call-template name="print-td">
<xsl:with-param name="count"
select="$counter" />
</xsl:call-template>
</xsl:if>
<td class="UpdateReference">
<xsl:text> Reference has been changed from </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/leftElement/@href" />
</xsl:call-template>
<xsl:text> to </xsl:text>
<xsl:call-template name="getname">
<xsl:with-param name="p_file"
select="$p_node/rightElement/@href" />
</xsl:call-template>
</td>
</tr>
</xsl:when>
<xsl:when
test="$diffType ='diff:UpdateUniqueReferenceValue'">
<tr>
<xsl:if test="$counter > 0">
<xsl:call-template name="print-td">
<xsl:with-param name="count"
select="$counter" />
</xsl:call-template>
</xsl:if>
<td class="UpdateUniqueReferenceValue">
<xsl:text> Reference has been changed from an </xsl:text>
<xsl:call-template name="getUpdatedRef">
<xsl:with-param name="p_file"
select="$p_node/leftElement/@href" />
</xsl:call-template>
<xsl:text> to an </xsl:text>
<xsl:call-template name="getUpdatedRef">
<xsl:with-param name="p_file"
select="$p_node/rightElement/@href" />
</xsl:call-template>
</td>
</tr>
</xsl:when>



</xsl:choose>




<!-- <xsl:for-each select="//subDiffElements[@xsi:type='diff:RemoveModelElement'] ">
<tr>
<td ><xsl:value-of select="rightParent/@href"/></td>
<td ><xsl:value-of select="leftElement/@href"/></td>
</tr>
</xsl:for-each> -->

</xsl:template>


<xsl:template name="getUpdatedRef">
<xsl:param name="p_file"></xsl:param>
<xsl:variable name="docFn">
<xsl:value-of select="substring-before($p_file,'#')" />
</xsl:variable>
<xsl:variable name="xmi_id">
<xsl:value-of select="substring-after($p_file,'#')" />
</xsl:variable>
<!-- <xsl:message>
p_file = <xsl:value-of select="$p_file"/>
docFn = <xsl:value-of select="$docFn"/>
xmi_id = <xsl:value-of select="$xmi_id"/>
</xsl:message> -->
<xsl:variable name="doc" select="document($docFn)" />
<xsl:variable name="id_El" select="$doc//*[@xmi:id=$xmi_id][1]" />



<xsl:if test="$id_El">
<!-- <xsl:element name="span">
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="$id_El/@xmi:type">
<xsl:value-of select="$id_El/@xmi:type" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="name($id_El)" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:element> -->

<xsl:choose>
<xsl:when test="$id_El/@type">
<!-- Internal -->
<xsl:variable name="intType" select="$id_El/@type" />
<xsl:variable name="id_El1"
select="$doc//*[@xmi:id=$intType][1]" />
<!-- <xsl:value-of select="concat('Internal Reference : ',$id_El1/@xmi:type,' ', $id_El1/@name)" /> -->
<xsl:element name="span">
<xsl:attribute name="class"
select="'InternalReference'" />
<xsl:value-of select="'Internal Reference :'" />
</xsl:element>

<xsl:element name="span">
<xsl:attribute name="class"
select="$id_El1/@xmi:type" />
<xsl:value-of
select="concat(' ',$id_El1/@xmi:type)" />
</xsl:element>

<xsl:element name="span">
<xsl:attribute name="class" select="'name'" />
<xsl:value-of
select="concat(' ',$id_El1/@name)" />
</xsl:element>

</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$id_El/type">
<!-- External -->
<xsl:variable name="extType"
select="$id_El/type" />
<!-- <xsl:value-of select="concat('External Reference : ',$extType/@xmi:type,' ', $extType/@href)" /> -->

<xsl:element name="span">
<xsl:attribute name="class"
select="'ExternalReference'" />
<xsl:value-of
select="'External Reference :'" />
</xsl:element>

<xsl:element name="span">
<xsl:attribute name="class"
select="$extType/@xmi:type" />
<xsl:value-of
select="concat(' ',$extType/@xmi:type)" />
</xsl:element>

<xsl:element name="span">
<xsl:attribute name="class"
select="'href'" />
<xsl:value-of
select="concat(' ',$extType/@href)" />
</xsl:element>
</xsl:when>
<xsl:otherwise>
<!-- <xsl:value-of select="$id_El/@name" /> -->
<xsl:value-of select="name($id_El)" />
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>




<xsl:template name="getname">

<xsl:param name="p_file"></xsl:param>
<xsl:variable name="docFn">
<xsl:value-of select="substring-before($p_file,'#')" />
</xsl:variable>
<xsl:variable name="xmi_id">
<xsl:value-of select="substring-after($p_file,'#')" />
</xsl:variable>
<!-- <xsl:message>
p_file = <xsl:value-of select="$p_file"/>
docFn = <xsl:value-of select="$docFn"/>
xmi_id = <xsl:value-of select="$xmi_id"/>
</xsl:message> -->
<xsl:choose>
<xsl:when test="contains($docFn,'pathmap')">
<xsl:message>
Pathmap found docFn how to handle? = <xsl:value-of select="$docFn"/>
</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="doc" select="document($docFn)" />
<xsl:variable name="id_El" select="$doc//*[@xmi:id=$xmi_id][1]" />
<!-- <xsl:message>
PackagedElement type = <xsl:value-of select="$id_El/@xmi:type" />
</xsl:message> -->


<xsl:if test="$id_El">
<xsl:element name="span">
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="$id_El/@xmi:type">
<xsl:value-of select="$id_El/@xmi:type" />
</xsl:when>
<xsl:otherwise>
<!-- <xsl:value-of select="$id_El/@name" /> -->
<xsl:value-of select="name($id_El)" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:choose>
<xsl:when test="name($id_El) = 'ownedComment'">
<xsl:value-of
select="concat('Comment : ',$id_El/body)" />
</xsl:when>
<xsl:when test="name($id_El) = 'packagedElement'">

<xsl:choose>
<xsl:when test="$id_El/@name">
<xsl:value-of select="$id_El/@name" />
</xsl:when>
<xsl:when
test="$id_El/@xmi:type = 'uml:Association'">
<xsl:value-of
select="'uml:Association '"/>

<xsl:call-template
name="getAssociation">
<xsl:with-param name="p_node"
select="$id_El" />
<xsl:with-param name="doc"
select="$doc" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- <xsl:value-of select="$id_El/@xmi:type" /> -->
<xsl:value-of
select="concat($id_El/@xmi:type,' id = ',$xmi_id)" />
<!-- <xsl:value-of select="concat('PE ',$xmi_id)" /> -->
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$id_El/@name">
<!-- <xsl:message>
name = <xsl:value-of select="$id_El/@name" />
</xsl:message>-->
<xsl:value-of select="$id_El/@name" />
</xsl:when>
<xsl:otherwise>
<!-- <xsl:message>
name of element =<xsl:value-of select="name($id_El)" />
</xsl:message>-->
<xsl:value-of select="name($id_El)" />
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>


</xsl:element>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="getAssociation">
<xsl:param name="p_node" />
<xsl:param name="doc" />

<xsl:variable name="member1">
<xsl:value-of
select="substring-before($p_node/@memberEnd,' ')" />
</xsl:variable>

<xsl:variable name="member2">
<xsl:value-of
select="substring-after($p_node/@memberEnd,' ')" />
</xsl:variable>

<!-- <xsl:message>
memberEnd =
<xsl:value-of select="$p_node/@memberEnd" />
member1 =
<xsl:value-of select="$member1" />
member2 =
<xsl:value-of select="$member2" />
</xsl:message> -->


<!-- <xsl:variable name="OA_1" select="$doc//ownedAttribute[@xmi:id=$member1][1]"/>
<xsl:variable name="OA_2" select="$doc//*[@xmi:id=$member2][1]"/>

<xsl:message>
OA_1 name = <xsl:value-of select="$OA_1/@name" />
OA_2 name = <xsl:value-of select="$OA_2/@name" />
</xsl:message> -->


<xsl:choose>
<xsl:when test="$p_node/ownedEnd">
<!-- <xsl:message>OwnedAssoc</xsl:message> -->
<xsl:call-template name="getOwnedAssociation">
<xsl:with-param name="p_node" select="$p_node" />
<xsl:with-param name="doc" select="$doc" />
<xsl:with-param name="member1" select="$member1" />
<xsl:with-param name="member2" select="$member2" />
</xsl:call-template>

</xsl:when>
<xsl:otherwise>
<!-- <xsl:message>Navigable Assoc</xsl:message> -->
<xsl:call-template name="getNavigableAssociation">
<!-- <xsl:with-param name="p_node" select="$p_node" /> -->
<xsl:with-param name="doc" select="$doc" />
<xsl:with-param name="member1" select="$member1" />
<xsl:with-param name="member2" select="$member2" />
</xsl:call-template>

</xsl:otherwise>
</xsl:choose>




</xsl:template>


<xsl:template name="getNavigableAssociation">
<xsl:param name="doc" />
<xsl:param name="member1" />
<xsl:param name="member2" />

<!-- <ownedAttribute xmi:id="_KeCiVjj2Edy0_uRL9hZ33w" name="testclass2" -->

<xsl:variable name="OA_1"
select="$doc//ownedAttribute[@xmi:id=$member1][1]" />
<xsl:variable name="OA_2"
select="$doc//ownedAttribute[@xmi:id=$member2][1]" />

<!-- <xsl:message>
Navigable Association OA_1 name =
<xsl:value-of select="$OA_1/@name" />
Navigable Association OA_2 name =
<xsl:value-of select="$OA_2/@name" />
</xsl:message> -->

<xsl:value-of select="'Navigable Association'"/>
<xsl:element name="br"/>
<xsl:value-of select="concat(' Source : ',$OA_1/@name)"/>
<xsl:element name="br"/>
<xsl:value-of select="concat(' Target : ',$OA_2/@name)" />

<!-- <xsl:value-of
select="concat('Navigable Association joining ',$OA_1/@name, ' with ',$OA_2/@name)" /> -->

</xsl:template>

<xsl:template name="getOwnedAssociation">
<xsl:param name="doc" />
<xsl:param name="p_node" />
<xsl:param name="member1" />
<xsl:param name="member2" />

<xsl:variable name="OE" select="$p_node/ownedEnd" />
<xsl:variable name="OE_name" select="$OE/@name" />
<xsl:variable name="OE_type" select="$OE/@type" />
<xsl:variable name="OA_1"
select="$doc//ownedAttribute[@xmi:id=$member1][1]" />
<xsl:variable name="OA_1_name" select="$OA_1/@name" />
<xsl:variable name="OA_1_type" select="$OA_1/@type" />


<xsl:variable name="OA_1_Target" select="$doc//packagedElement[@xmi:id=$OA_1_type][1]" />

<!-- <xsl:message> name of pnode = <xsl:value-of select="name($p_node)" />
type of pnode = <xsl:value-of select="$p_node/@xmi:type"/>
</xsl:message> -->
<!-- <xsl:message>
OA_1 = <xsl:value-of select="name($OA_1)"/>
OA_1_type = <xsl:value-of select="$OA_1_type" />
OA_1_Target = <xsl:value-of select="name($OA_1_Target)"/>
</xsl:message> -->
<!-- <xsl:message> name of OE = <xsl:value-of select="name($OE)" />
nameAtt of OE = <xsl:value-of select="$p_node/ownedEnd/@name" />
id of OE = <xsl:value-of select="$p_node/ownedEnd/@xmi:id" />
</xsl:message> -->
<!-- <xsl:message> OE_Type = <xsl:value-of select="$OE_type" />
</xsl:message>
<xsl:message>
OA_1 = <xsl:value-of select="name($OA_1)"/>
OA_1_type = <xsl:value-of select="$OA_1_type" />
</xsl:message> -->


<xsl:variable name="OA_1_Parent" select="../$OA_1" />

<xsl:variable name="OA_1_Parent_name" select="../$OA_1/@name" />

<xsl:variable name="OA_1_LinkedByType"
select="$doc//packagedElement[@xmi:id=$OE_type][1]" />

<xsl:variable name="OA_1_LinkedByType_name"
select="$OA_1_LinkedByType/@name" />

<!-- <xsl:message>
Owned Association OE_name name =
<xsl:value-of select="$OE_name" />
Owned Association OA_1_Parent_name name =
<xsl:value-of select="$OA_1_Parent_name" />
Owned Association OA_1_LinkedByType_name name =
<xsl:value-of select="$OA_1_LinkedByType_name" />
</xsl:message> -->

<xsl:if test="$OA_1_Parent_name">
<xsl:element name="br"/>
<xsl:value-of select="concat(' Role : ',$OA_1_Parent_name)" />
<xsl:element name="br"/>
</xsl:if>

<xsl:choose>
<xsl:when test="$OA_1_Target">
<xsl:value-of select="concat(' Source : ',$OA_1_LinkedByType_name)"/>
<xsl:element name="br"/>
<xsl:value-of select="concat(' Target : ',$OA_1_Target/@name)" />
</xsl:when>
<xsl:otherwise>
<xsl:if test="$OA_1_LinkedByType_name">
<xsl:value-of select="concat(' Source : ',$OA_1_LinkedByType_name)"/>
</xsl:if>
</xsl:otherwise>

</xsl:choose>

</xsl:template>

<xsl:template name="print-td">
<xsl:param name="count" />
<xsl:if test="$count"><!-- print the td for this iteration -->
<td class="filler_td"><!-- <xsl:value-of select="$count" /> -->
</td>
<xsl:call-template name="print-td">
<xsl:with-param name="count" select="$count -1" />
</xsl:call-template>
</xsl:if>
</xsl:template>

<xsl:template name="getFN">
<xsl:param name="f_string" />
<xsl:variable name="docFn">
<xsl:value-of select="substring-before($f_string,'#')" />
</xsl:variable>

<xsl:variable name="docFn1">
<xsl:value-of select="substring-after($docFn,'file:/')" />
</xsl:variable>

<xsl:value-of select="$docFn1" />

</xsl:template>


<xsl:template name="changeCounter">
<xsl:param name="p_node" />
<xsl:value-of
select=" count($p_node//descendant::subDiffElements[not(@xsi:type='di ff:DiffGroup')]) " />
</xsl:template>



</xsl:stylesheet>

--------------040608010400030607010508--
Previous Topic:[Compare] Minor buglet
Next Topic:[Compare] Minor buglet
Goto Forum:
  


Current Time: Sat Aug 13 00:45:57 GMT 2022

Powered by FUDForum. Page generated in 0.01488 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top