xml - getting an attribute value by another one -
i'm trying attribute value different tag. here's xml file:
<xmi xmi.version='1.2' timestamp='fri apr 24 12:24:29 wat 2015' xmlns:uml='omg.org/uml/1.4'> <xmi.header> <xmi.documentation> <xmi.exporter>magicdraw uml</xmi.exporter> <xmi.exporterversion>9.0</xmi.exporterversion> </xmi.documentation> <xmi.metamodel xmi.name='uml' xmi.version='1.4'/> </xmi.header> <xmi.content> <uml:model xmi.id='eee_1045467100313_135436_1' name='data'> <uml:namespace.ownedelement> <uml:package xmi.id='_9_0_1abc0480_1360417290093_794953_110' name='hr'> <uml:namespace.ownedelement> <uml:class xmi.id='_9_0_1abc0480_1360417356156_809319_114' name='employee'> <uml:modelelement.stereotype> <uml:stereotype href='newmodel.xml|egiva_1022741650486_759581_123'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='data types::entity'/> </xmi.extension> </uml:stereotype> </uml:modelelement.stereotype> <uml:namespace.ownedelement> <uml:abstraction xmi.id='_9_0_1abc0480_1360417353312_416353_113' client='_9_0_1abc0480_1360417356156_809319_114'> <uml:modelelement.stereotype> <uml:stereotype href='newmodel.xml|_9_0_897027e_1105630590734_613299_511'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='data types::realize'/> </xmi.extension> </uml:stereotype> </uml:modelelement.stereotype> <uml:dependency.supplier> <uml:modelelement href='newmodel.xml|osama_1059572400642_541580_122'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::new::arch::basicstruct::data::abstractvalue'/> </xmi.extension> </uml:modelelement> </uml:dependency.supplier> </uml:abstraction> </uml:namespace.ownedelement> <uml:classifier.feature> <uml:attribute xmi.id='_9_0_1abc0480_1360417405078_72412_147' name='identifier'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360417783468_448855_210'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360417783468_577212_211' lower='1' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> <uml:modelelement.stereotype> <uml:stereotype href='newmodel.xml|_5f701fc_1096291047273_745359_1547'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='data types::code'/> </xmi.extension> </uml:stereotype> <uml:stereotype href='newmodel.xml|_5f701fc_1096282286643_472107_1342'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='data types::sequence'/> </xmi.extension> </uml:stereotype> </uml:modelelement.stereotype> <uml:structuralfeature.type> <uml:classifier href='newmodel.xml|ahmad_1057828584656_303948_819'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::new::arch::basicstruct::data::longvalue'/> </xmi.extension> </uml:classifier> </uml:structuralfeature.type> </uml:attribute> <uml:attribute xmi.id='_9_0_1abc0480_1360417733453_835499_209' name='nationalnumber'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360417783468_891620_212'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360417783468_892394_213' lower='1' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> <uml:modelelement.stereotype> <uml:stereotype href='newmodel.xml|_5f701fc_1096291083287_539898_1561'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='data types::unique'/> </xmi.extension> </uml:stereotype> </uml:modelelement.stereotype> <uml:structuralfeature.type> <uml:classifier href='newmodel.xml|ahmad_1057828584656_303948_819'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::new::arch::basicstruct::data::longvalue'/> </xmi.extension> </uml:classifier> </uml:structuralfeature.type> </uml:attribute> <uml:attribute xmi.id='_9_0_1abc0480_1360417420906_228687_149' name='firstname'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360417783468_425799_214'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360417783468_373524_215' lower='1' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> <uml:structuralfeature.type> <uml:classifier href='newmodel.xml|ahmad_1057828584656_67517_836'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::new::arch::basicstruct::data::stringvalue'/> </xmi.extension> </uml:classifier> </uml:structuralfeature.type> </uml:attribute> <uml:attribute xmi.id='_9_0_1abc0480_1360417434156_213690_151' name='lastname'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360417783468_611745_216'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360417783468_180814_217' lower='1' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> <uml:structuralfeature.type> <uml:classifier href='newmodel.xml|ahmad_1057828584656_67517_836'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::new::arch::basicstruct::data::stringvalue'/> </xmi.extension> </uml:classifier> </uml:structuralfeature.type> </uml:attribute> <uml:attribute xmi.id='_9_0_1abc0480_1360417449984_748333_153' name='birthdate'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360417783468_837478_218'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360417783468_515637_219' lower='1' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> <uml:structuralfeature.type> <uml:classifier href='newmodel.xml|5f701fc_1081944857059_464638_0'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::new::arch::basicstruct::data::businessdate'/> </xmi.extension> </uml:classifier> </uml:structuralfeature.type> </uml:attribute> <uml:attribute xmi.id='_9_0_1abc0480_1360417653468_896023_199' name='age'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360417783468_747933_220'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360417783468_274122_221' lower='1' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> <uml:structuralfeature.type> <uml:classifier href='newmodel.xml|ahmad_1057828584656_716005_817'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::new::arch::basicstruct::data::integervalue'/> </xmi.extension> </uml:classifier> </uml:structuralfeature.type> </uml:attribute> <uml:attribute xmi.id='_9_0_1abc0480_1360417667046_866560_201' name='address'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360417783468_142919_222'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360417783468_940840_223' lower='1' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> <uml:structuralfeature.type> <uml:classifier href='newmodel.xml|osama_1057833941718_811415_136'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::new::arch::basicstruct::data::textvalue'/> </xmi.extension> </uml:classifier> </uml:structuralfeature.type> </uml:attribute> <uml:attribute xmi.id='_9_0_1abc0480_1360417684531_808413_203' name='phonenumber'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360418132359_292342_291'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360418132359_144507_292' lower='1' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> <uml:structuralfeature.type> <uml:classifier href='newmodel.xml|ahmad_1057828584656_67517_836'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::new::arch::basicstruct::data::stringvalue'/> </xmi.extension> </uml:classifier> </uml:structuralfeature.type> </uml:attribute> <uml:attribute xmi.id='_9_0_1abc0480_1360417699265_17119_205' name='contractstartdate'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360417783468_343557_226'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360417783468_361878_227' lower='1' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> <uml:structuralfeature.type> <uml:classifier href='newmodel.xml|5f701fc_1081944857059_464638_0'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::new::arch::basicstruct::data::businessdate'/> </xmi.extension> </uml:classifier> </uml:structuralfeature.type> </uml:attribute> <uml:attribute xmi.id='_9_0_1abc0480_1360417718562_213156_207' name='contractenddate'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360417783468_929078_228'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360417783468_350602_229' lower='0' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> <uml:structuralfeature.type> <uml:classifier href='newmodel.xml|5f701fc_1081944857059_464638_0'> <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::arch::basicstruct::data::businessdate'/> </xmi.extension> </uml:classifier> </uml:structuralfeature.type> </uml:attribute> <uml:attribute xmi.id='_9_0_1abc0480_1360417795250_360778_246' name='civilstate' type='_9_0_1abc0480_1360417555656_961843_176'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360418132359_514503_293'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360418132359_191202_294' lower='1' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> </uml:attribute> <uml:attribute xmi.id='_9_0_1abc0480_1360417815687_976484_248' name='numberofchildren'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360418132359_201182_295'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360418132359_799315_296' lower='0' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> <uml:structuralfeature.type> <uml:classifier > <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::new::arch::basicstruct::data::integervalue'/> </xmi.extension> </uml:classifier> </uml:structuralfeature.type> </uml:attribute> <uml:attribute xmi.id='_9_0_1abc0480_1360417865968_440560_250' name='salary'> <uml:structuralfeature.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360418132359_655101_297'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360418132359_229798_298' lower='1' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:structuralfeature.multiplicity> <uml:structuralfeature.type> <uml:classifier > <xmi.extension xmi.extender='magicdraw uml 9.0' xmi.extenderid='magicdraw uml 9.0'> <referentpath xmi.value='com::new::arch::basicstruct::data::doublevalue'/> </xmi.extension> </uml:classifier> </uml:structuralfeature.type> </uml:attribute> </uml:classifier.feature> </uml:class> <uml:association xmi.id='_9_0_1abc0480_1360418146656_245894_318'> <uml:association.connection> <uml:associationend xmi.id='_9_0_1abc0480_1360418146656_962005_316' isnavigable='true' aggregation='aggregate' participant='_9_0_1abc0480_1360417356156_809319_114'> <uml:associationend.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360418222968_828268_417'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360418222968_333793_418' lower='0' upper='-1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:associationend.multiplicity> </uml:associationend> <uml:associationend xmi.id='_9_0_1abc0480_1360418146656_839833_317' isnavigable='true' participant='_9_0_1abc0480_1360417892796_581831_252'> <uml:associationend.multiplicity> <uml:multiplicity xmi.id='_9_0_1abc0480_1360418222968_561784_419'> <uml:multiplicity.range> <uml:multiplicityrange xmi.id='_9_0_1abc0480_1360418222968_684290_420' lower='1' upper='1'/> </uml:multiplicity.range> </uml:multiplicity> </uml:associationend.multiplicity> </uml:associationend> </uml:association.connection> </uml:association </uml:namespace.ownedelement> </uml:package> </uml:namespace.ownedelement> </uml:model> </xmi.content> </xmi>
i want extract value of attribute name of tag <uml:class>
attribute participant of <uml:association>
. here did in xslt file :
<xsl:stylesheet xmlns:uml='omg.org/uml/1.4' xmlns:xmi="http://www.omg.org/xmi" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/uml" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/ecore" xmlns:palmyraumlprofile="http:///schemas/palmyraumlprofile/_oxvaunuaeecgfpbtt2dtfq/5" xmlns:fn="http://www.w3.org/2005/xpath-functions" version="1.0"> <xsl:output indent="yes" method="xml" /> <xsl:strip-space elements="*" /> <xsl:template match="uml:class"> <packagedelement> <xsl:attribute name="xmi:type">uml:class</xsl:attribute> <xsl:attribute name="xmi:id"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="@name" /> </xsl:attribute> <generalization> <xsl:attribute name="xmi:id"> <xsl:value-of select="generate-id()" /> </xsl:attribute> <general xmi:type="uml:class" /> </generalization> <xsl:for-each select="//uml:association/uml:association.connection/uml:associationend/@aggregation='composite'"> </xsl:for-each> <xsl:for-each select="uml:classifier.feature/uml:attribute"> <ownedattribute> <xsl:attribute name="xmi:id"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="@name" /> </xsl:attribute> <xsl:attribute name="isunique">false</xsl:attribute> <xsl:variable name="hreff"> <xsl:call-template name="replace_palmyra"> <xsl:with-param name="text" select="uml:structuralfeature.type/uml:classifier/@href" /> <xsl:with-param name="replace" select="'palmyramodel.xml|'" /> <xsl:with-param name="by" select="'platform:/plugin/palmyraumlprofile/palmyramodel/palmyramodel.uml#'" /> </xsl:call-template> </xsl:variable> <type xmi:type="uml:class" href="{$hreff}" /> <xsl:choose> <xsl:when test="uml:structuralfeature.multiplicity/uml:multiplicity/uml:multiplicity.range/uml:multiplicityrange/@lower !=''"> <lowervalue xmi:type="uml:literalinteger" xmi:id="{generate-id()}" value="{uml:structuralfeature.multiplicity/uml:multiplicity/uml:multiplicity.range/uml:multiplicityrange/@lower}" /> </xsl:when> <xsl:otherwise> <lowervalue xmi:type="uml:literalinteger" xmi:id="{generate-id()}" /> </xsl:otherwise> </xsl:choose> </ownedattribute> </xsl:for-each> </packagedelement> <xsl:apply-templates /> </xsl:template> <xsl:template match="uml:association"> <xsl:choose> <xsl:when test="uml:association.connection/uml:associationend/@aggregation='composite'"> <packagedelement> <xsl:attribute name="xmi:type">uml:association</xsl:attribute> <xsl:attribute name="xmi:id"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <xsl:attribute name="name">compositon</xsl:attribute> <xsl:variable name="member1" select="concat(generate-id(),'a1')" /> <xsl:variable name="member2" select="concat(generate-id(),'a2')" /> <xsl:attribute name="memberend"> <xsl:value-of select="concat($member1,' ',$member2)" /> </xsl:attribute> <ownedend> <xsl:attribute name="xmi:id"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <!--<xsl:variable name="name-association1"> <xsl:value-of select="uml:association.connection/uml:associationend[1]/@participant" /> <xsl:value-of select="*/uml:class[@id='uml:association.connection/uml:associationend[1]/@participant']/@name"/> </xsl:variable> --> <xsl:attribute name="name"> <xsl:value-of select="hello" /> </xsl:attribute> <xsl:attribute name="type"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <xsl:attribute name="isunique">false</xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="association" /> </xsl:attribute> <uppervalue xmi:type="uml:literalunlimitednatural" xmi:id="{concat(generate-id(),'id1')}" value="{uml:association.connection/uml:associationend/uml:associationend.multiplicity/uml:multiplicity/uml:multiplicity.range/uml:multiplicityrange/@upper}" /> <lowervalue xmi:type="uml:literalinteger" xmi:id="{concat(generate-id(),'id2')}" value="{uml:association.connection/uml:associationend/uml:associationend.multiplicity/uml:multiplicity/uml:multiplicity.range/uml:multiplicityrange/@lower}" /> </ownedend> </packagedelement> </xsl:when> <xsl:when test="uml:association.connection/uml:associationend/@aggregation='aggregate'"> <packagedelement> <xsl:attribute name="xmi:type">uml:association</xsl:attribute> <xsl:attribute name="xmi:id"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <xsl:attribute name="name">aggregation</xsl:attribute> <xsl:variable name="member1" select="concat(generate-id(),'a1')" /> <xsl:variable name="member2" select="concat(generate-id(),'a2')" /> <xsl:variable name="id1" select="uml:association.connection/uml:associationend[1]/@participant" /> <xsl:variable name="id2" select="uml:association.connection/uml:associationend[2]/@participant" /> <xsl:attribute name="memberend"> <xsl:value-of select="concat($member1,' ',$member2)" /> </xsl:attribute> <ownedend> <xsl:attribute name="xmi:id"> <xsl:value-of select="$member1" /> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-ofselect="//uml:class[@xmi.id='uml:association.connection/uml:associationend/@participant']/@name" /> </xsl:attribute>" /> </xsl:attribute> <xsl:attribute name="type"> <xsl:value-of select="uml:association.connection/uml:associationend[1]/@participant" /> </xsl:attribute> <xsl:attribute name="isunique">false</xsl:attribute> <xsl:attribute name="association"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <uppervalue xmi:type="uml:literalunlimitednatural" xmi:id="{generate-id()}" value="{uml:association.connection/uml:associationend[1]/uml:associationend.multiplicity/uml:multiplicity/uml:multiplicity.range/uml:multiplicityrange/@upper}" /> <lowervalue xmi:type="uml:literalinteger" xmi:id="{generate-id()}" value="{uml:association.connection/uml:associationend[1]/uml:associationend.multiplicity/uml:multiplicity/uml:multiplicity.range/uml:multiplicityrange/@lower}" /> </ownedend> <ownedend> <xsl:attribute name="xmi:id"> <xsl:value-of select="$member2" /> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="hello" /> </xsl:attribute> <xsl:attribute name="type"> <xsl:value-of select="uml:association.connection/uml:associationend[2]/@participant" /> </xsl:attribute> <xsl:attribute name="isunique">false</xsl:attribute> <xsl:attribute name="association"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <uppervalue xmi:type="uml:literalunlimitednatural" xmi:id="{generate-id()}" value="{uml:association.connection/uml:associationend[2]/uml:associationend.multiplicity/uml:multiplicity/uml:multiplicity.range/uml:multiplicityrange/@upper}" /> <lowervalue xmi:type="uml:literalinteger" xmi:id="{generate-id()}" value="{uml:association.connection/uml:associationend[2]/uml:associationend.multiplicity/uml:multiplicity/uml:multiplicity.range/uml:multiplicityrange/@lower}" /> </ownedend> </packagedelement> </xsl:when> <xsl:when test="uml:association.connection/uml:associationend[not(@aggregation)]"> <packagedelement> <xsl:attribute name="xmi:type">association</xsl:attribute> <xsl:attribute name="xmi:id"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="association" /> </xsl:attribute> <xsl:variable name="member1" select="concat(generate-id(),'a1')" /> <xsl:variable name="member2" select="concat(generate-id(),'a2')" /> <xsl:attribute name="memberend"> <xsl:value-of select="concat($member1,' ',$member2)" /> </xsl:attribute> <ownedend> <xsl:attribute name="xmi:id"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="hello" /> </xsl:attribute> <xsl:attribute name="type"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <xsl:attribute name="isunique">false</xsl:attribute> <xsl:attribute name="association"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <uppervalue xmi:type="uml:literalunlimitednatural" xmi:id="{generate-id()}" value="{uml:association.connection/uml:associationend[1]/uml:associationend.multiplicity/uml:multiplicity/uml:multiplicity.range/uml:multiplicityrange/@upper}" /> <lowervalue xmi:type="uml:literalinteger" xmi:id="{generate-id()}" value="{uml:association.connection/uml:associationend[1]/uml:associationend.multiplicity/uml:multiplicity/uml:multiplicity.range/uml:multiplicityrange/@lower}" /> </ownedend> <ownedend> <xsl:attribute name="xmi:id"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="uml:class[@id='']" /> </xsl:attribute> <xsl:attribute name="type"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <xsl:attribute name="isunique">false</xsl:attribute> <xsl:attribute name="association"> <xsl:value-of select="@xmi.id" /> </xsl:attribute> <uppervalue xmi:type="uml:literalunlimitednatural" xmi:id="{generate-id()}" value="{uml:association.connection/uml:associationend[2]/uml:associationend.multiplicity/uml:multiplicity/uml:multiplicity.range/uml:multiplicityrange/@upper}" /> <lowervalue xmi:type="uml:literalinteger" xmi:id="{generate-id()}" value="{uml:association.connection/uml:associationend[2]/uml:associationend.multiplicity/uml:multiplicity/uml:multiplicity.range/uml:multiplicityrange/@lower}" /> </ownedend> </packagedelement> </xsl:when> </xsl:choose> <xsl:apply-templates /> </xsl:template> </xsl:stylesheet>
if declare <xsl:key>
@ root level of stylesheet:
<xsl:key name="umlclasses" match="uml:class" use="@xmi.id" />
then can retrieve class name (uml:class/@name
) following instruction:
<xsl:value-of select="key('umlclasses', uml:association.connection/uml:associationend/@participant)/@name" />
for example, output:
<ownedend xmi:id="d1e155a1" name="employee" type="_9_0_1abc0480_1360417356156_809319_114" isunique="false" association="_9_0_1abc0480_1360418146656_245894_318"> <uppervalue xmi:type="uml:literalunlimitednatural" xmi:id="d1e155" value="-1"/> <lowervalue xmi:type="uml:literalinteger" xmi:id="d1e155" value="0"/> </ownedend>
however, there might issue because uml:association.connection/uml:associationend
may retrieve several nodes (<association.connection>
can have more 1 <associationend>
). if first associationend right one, it's you. if not, might have perform appropriate selection according requirements.
Comments
Post a Comment