Author: fdesbois Date: 2010-06-03 18:29:27 +0200 (Thu, 03 Jun 2010) New Revision: 914 Url: http://nuiton.org/repositories/revision/eugene/914 Log: maybe a bug on xsl for Exception Modified: trunk/eugene/src/main/xsl/xmi1.2ToObjectModel.xsl Modified: trunk/eugene/src/main/xsl/xmi1.2ToObjectModel.xsl =================================================================== --- trunk/eugene/src/main/xsl/xmi1.2ToObjectModel.xsl 2010-06-02 10:27:33 UTC (rev 913) +++ trunk/eugene/src/main/xsl/xmi1.2ToObjectModel.xsl 2010-06-03 16:29:27 UTC (rev 914) @@ -8,12 +8,12 @@ xmlns:packageValidator="xalan://org.nuiton.eugene.PackageValidator" xmlns:UML="org.omg.xmi.namespace.UML" xmlns:UML2="org.omg.xmi.namespace.UML2"> - <xsl:output method="xml" + <xsl:output method="xml" encoding="UTF-8" - indent="yes" + indent="yes" xalan:indent-amount="2"/> - + <!-- processing entry point. We'll process everything from that root package path. Everything else is ignored --> <xsl:param name="fullPackagePath"/> <xsl:param name="extraPackages"/> @@ -31,7 +31,7 @@ <xsl:attribute name="name"> <xsl:value-of select="../@name"/> </xsl:attribute> - + <!-- ajout de l'attribut version disponible dans les taggedValue --> <xsl:attribute name="version"> <xsl:variable name="versionTagId"> @@ -43,24 +43,24 @@ <xsl:for-each select="descendant::UML:Namespace.ownedElement/UML:Comment[not(UML:Comment.annotatedElement)]"> <xsl:call-template name="comment"/> </xsl:for-each> - - <xsl:apply-templates> + + <xsl:apply-templates> <xsl:with-param name="parentLocalPackageName"/> </xsl:apply-templates> </xsl:element> </xsl:template> <xsl:template match="text()|attribute"/> - + <xsl:template match="*"> <xsl:param name="parentLocalPackageName"/> - <xsl:apply-templates> + <xsl:apply-templates> <xsl:with-param name="parentLocalPackageName"> <xsl:value-of select="$parentLocalPackageName"/> </xsl:with-param> </xsl:apply-templates> </xsl:template> - + <xsl:template match="UML:Package"> <xsl:param name="parentLocalPackageName"/> <xsl:variable name="packageName"> @@ -78,7 +78,7 @@ <xsl:choose> <xsl:when test="packageValidator:toContinue($fullPackagePath, $localPackageNameDot, $extraPackages)"> - <xsl:apply-templates> + <xsl:apply-templates> <xsl:with-param name="parentLocalPackageName"> <xsl:value-of select="$localPackageNameDot"/> </xsl:with-param> @@ -113,7 +113,7 @@ </xsl:with-param> </xsl:call-template> </xsl:for-each> - <xsl:apply-templates> + <xsl:apply-templates> <xsl:with-param name="parentLocalPackageName"> <xsl:value-of select="$localPackageNameDot"/> </xsl:with-param> @@ -122,8 +122,8 @@ </xsl:choose> </xsl:template> - - + + <!-- . . @@ -131,8 +131,8 @@ . . --> - + <xsl:template name="UMLInterface"> <xsl:param name="localPackageName"/> <xsl:variable name="interfaceId"> @@ -179,8 +179,8 @@ </xsl:template> - - + + <xsl:template name="UMLClass"> <xsl:param name="localPackageName"/> <xsl:variable name="classId"> @@ -199,7 +199,7 @@ <xsl:text>true</xsl:text> </xsl:attribute> </xsl:if> - + <xsl:call-template name="extern"/> <xsl:attribute name="package"> @@ -259,8 +259,8 @@ </xsl:template> - - + + <xsl:template name="UMLAssociationClass"> <xsl:param name="localPackageName"/> <xsl:variable name="classId"> @@ -279,7 +279,7 @@ <xsl:text>true</xsl:text> </xsl:attribute> </xsl:if> - + <xsl:call-template name="extern"/> <xsl:attribute name="package"> @@ -329,7 +329,7 @@ </xsl:for-each> </xsl:element> </xsl:for-each> - + <!-- class attributes --> <xsl:for-each select="UML:Classifier.feature/UML:Attribute"> <xsl:call-template name="UMLAttribute"/> @@ -376,7 +376,7 @@ </xsl:for-each> </xsl:element> </xsl:template> - + <xsl:template name="UMLAbstractions"> <xsl:param name="classId"/> <xsl:for-each select="/XMI/XMI.content/UML:Model/UML:Namespace.ownedElement/descendant::UML:Abstraction[UML:Dependency.client/UML:Class/@xmi.idref=$classId]"> @@ -384,8 +384,8 @@ </xsl:for-each> </xsl:template> - - + + <xsl:template name="UMLAbstraction"> <xsl:variable name="idInterface"> <xsl:value-of select="UML:Dependency.supplier/UML:Interface/@xmi.idref"/> @@ -412,8 +412,8 @@ </xsl:for-each> </xsl:template> - - + + <xsl:template name="UMLGeneralizations"> <xsl:param name="classId"/> <xsl:for-each select="/XMI/XMI.content/UML:Model/UML:Namespace.ownedElement/descendant::UML:Generalization[UML:Generalization.child/UML:Class/@xmi.idref=$classId]"> @@ -465,7 +465,7 @@ </xsl:for-each> </xsl:template> - + <xsl:template name="UMLAssociations"> <xsl:param name="classId"/> <xsl:for-each select="/XMI/XMI.content/UML:Model/UML:Namespace.ownedElement/descendant::UML:Association.connection/UML:AssociationEnd[UML:AssociationEnd.participant/*/@xmi.idref=$classId]"> @@ -478,8 +478,8 @@ </xsl:for-each> </xsl:template> - - + + <xsl:template name="UMLAssociation"> <!-- BB <xsl:if test="@isNavigable='true'"> --> <xsl:element name="attribute"> @@ -487,15 +487,15 @@ <xsl:attribute name="name"> <xsl:value-of select="@name"/> </xsl:attribute> - </xsl:if> + </xsl:if> <xsl:attribute name="visibility"> <xsl:value-of select="@visibility"/> </xsl:attribute> - + <xsl:variable name="asClassId"> <xsl:value-of select="ancestor::UML:AssociationClass/@xmi.id"/> </xsl:variable> - + <xsl:if test="$asClassId"> <xsl:for-each select="ancestor::UML:AssociationClass"> <xsl:attribute name="associationClassName"> @@ -534,7 +534,7 @@ <xsl:attribute name="reverseMaxMultiplicity"> <xsl:value-of select="$reverseMaxMultiplicity"/> </xsl:attribute> - </xsl:if> + </xsl:if> </xsl:for-each> <xsl:if test="UML:AssociationEnd.multiplicity"> @@ -545,7 +545,7 @@ <xsl:attribute name="minMultiplicity"> <xsl:value-of select="$minMultiplicity"/> </xsl:attribute> - </xsl:if> + </xsl:if> <xsl:variable name="maxMultiplicity"> <xsl:value-of select="UML:AssociationEnd.multiplicity/UML:Multiplicity/UML:Multiplicity.range/UML:MultiplicityRange/@upper"/> </xsl:variable> @@ -553,7 +553,7 @@ <xsl:attribute name="maxMultiplicity"> <xsl:value-of select="$maxMultiplicity"/> </xsl:attribute> - </xsl:if> + </xsl:if> </xsl:if> <xsl:attribute name="navigable"> @@ -567,14 +567,14 @@ <xsl:call-template name="taggedValue"/> </xsl:for-each> - <xsl:call-template name="stereotype"/> + <xsl:call-template name="stereotype"/> </xsl:element> <!-- BB </xsl:if> --> </xsl:template> - - + + <xsl:template name="UMLAttribute"> <xsl:element name="attribute"> @@ -600,7 +600,7 @@ <xsl:text>true</xsl:text> </xsl:attribute> </xsl:if> - + <xsl:if test="@changeability='frozen'"> <xsl:attribute name="final"> <xsl:text>true</xsl:text> @@ -612,7 +612,7 @@ <xsl:with-param name="childpath">UML:StructuralFeature.type</xsl:with-param> </xsl:call-template> </xsl:attribute> - + <xsl:if test="UML:StructuralFeature.multiplicity"> <xsl:variable name="minMultiplicity"> <xsl:value-of select="UML:StructuralFeature.multiplicity/UML:Multiplicity/UML:Multiplicity.range/UML:MultiplicityRange/@lower"/> @@ -621,7 +621,7 @@ <xsl:attribute name="minMultiplicity"> <xsl:value-of select="$minMultiplicity"/> </xsl:attribute> - </xsl:if> + </xsl:if> <xsl:variable name="maxMultiplicity"> <xsl:value-of select="UML:StructuralFeature.multiplicity/UML:Multiplicity/UML:Multiplicity.range/UML:MultiplicityRange/@upper"/> </xsl:variable> @@ -629,7 +629,7 @@ <xsl:attribute name="maxMultiplicity"> <xsl:value-of select="$maxMultiplicity"/> </xsl:attribute> - </xsl:if> + </xsl:if> </xsl:if> <xsl:for-each select="UML:ModelElement.taggedValue/UML:TaggedValue"> @@ -639,21 +639,21 @@ <xsl:for-each select="UML:ModelElement.comment/UML:Comment"> <xsl:call-template name="UMLComment"/> </xsl:for-each> - + <!-- default value of attribute --> <xsl:if test="UML:Attribute.initialValue"> <xsl:attribute name="defaultValue"> <xsl:value-of select="UML:Attribute.initialValue/UML:Expression/@body"/> </xsl:attribute> </xsl:if> - - <xsl:call-template name="stereotype"/> + <xsl:call-template name="stereotype"/> + </xsl:element> </xsl:template> - - + + <xsl:template name="UMLOperation"> <xsl:element name="operation"> <xsl:attribute name="name"> @@ -674,7 +674,7 @@ <xsl:text>true</xsl:text> </xsl:attribute> </xsl:if> - + <xsl:for-each select="UML:ModelElement.taggedValue/UML:TaggedValue"> <xsl:call-template name="taggedValue"/> </xsl:for-each> @@ -686,7 +686,7 @@ <xsl:call-template name="UMLReturnParameter"/> </xsl:when> <xsl:otherwise> - <xsl:call-template name="UMLParameter"/> + <xsl:call-template name="UMLParameter"/> </xsl:otherwise> </xsl:choose> </xsl:for-each> @@ -694,7 +694,7 @@ <xsl:for-each select="UML:ModelElement.comment/UML:Comment"> <xsl:call-template name="UMLComment"/> </xsl:for-each> - + <!-- exceptions --> <xsl:variable name="operationId"> <xsl:value-of select="@xmi.id"/> @@ -702,29 +702,13 @@ <xsl:for-each select="/XMI/XMI.content/UML:A_context_raisedSignal/UML:Operation[@xmi.idref = $operationId]"> <xsl:variable name="exceptionId"> - <xsl:value-of select="concat(following::UML:Exception/@xmi.idref,following::UML:Signal/@xmi.idref)"/> + <xsl:value-of select="concat(following::UML:Exception/@xmi.idref,following::UML:Signal/@xmi.idref)"/> </xsl:variable> <xsl:for-each select="/XMI/XMI.content/UML:Model/UML:Namespace.ownedElement/descendant::UML:Exception[@xmi.id = $exceptionId]"> - <xsl:element name="exceptionParameter"> - <xsl:attribute name="name"> - <xsl:value-of select="@name"/> - </xsl:attribute> - <xsl:attribute name="type"> - <xsl:call-template name="packagePathOfWithDot"/> - <xsl:value-of select="parent::UML:Namespace.ownedElement/parent::UML:Class/@name"/> - </xsl:attribute> - </xsl:element> + <xsl:call-template name="exception"/> </xsl:for-each> <xsl:for-each select="/XMI/XMI.content/UML:Model/UML:Namespace.ownedElement/descendant::UML:Signal[@xmi.id = $exceptionId]"> - <xsl:element name="exceptionParameter"> - <xsl:attribute name="name"> - <xsl:value-of select="@name"/> - </xsl:attribute> - <xsl:attribute name="type"> - <xsl:call-template name="packagePathOfWithDot"/> - <xsl:value-of select="@name"/> - </xsl:attribute> - </xsl:element> + <xsl:call-template name="exception"/> </xsl:for-each> </xsl:for-each> @@ -733,8 +717,18 @@ </xsl:element> </xsl:template> + <xsl:template name="exception"> + <xsl:element name="exceptionParameter"> + <xsl:attribute name="name"> + <xsl:value-of select="@name" /> + </xsl:attribute> + <xsl:attribute name="type"> + <xsl:call-template name="packagePathOfWithDot" /> + <xsl:value-of select="@name" /> + </xsl:attribute> + </xsl:element> + </xsl:template> - <xsl:template name="UMLParameter"> <xsl:element name="parameter"> <xsl:attribute name="name"> @@ -783,10 +777,10 @@ <xsl:template name="comment"> <xsl:element name="comment"> - <xsl:value-of select="@body"/> + <xsl:value-of select="@body"/> </xsl:element> </xsl:template> - + <xsl:template name="extern"> <xsl:for-each select="UML:ModelElement.stereotype/UML:Stereotype"> <xsl:variable name="id"> @@ -859,7 +853,7 @@ <xsl:template name="fullClassName"> <xsl:param name="childpath"/> - + <xsl:if test="count(child::*[name() = $childpath]) = 1"> <xsl:choose> <xsl:when test="child::*[name() = $childpath]/*/@xmi.idref"> @@ -888,7 +882,7 @@ <xsl:if test="name()!='UML:DataType'"> <xsl:for-each select="ancestor::UML:Package"> <xsl:value-of select="@name"/> - <xsl:value-of select="string('.')"/> + <xsl:value-of select="string('.')"/> </xsl:for-each> </xsl:if> </xsl:template>
participants (1)
-
fdesbois@users.nuiton.org