Hi i am using XSLT transformation to transform one xmi file to uml file. In my xml files i have two different nodes:
First node:

<ownedAttribute xmi:type="uml:Property"                          xmi:id="EAID_9D13F3CF_4FDB_46bc_B47F_8B4DC9C6DADD" 
name="Part2" 
visibility="public" 
aggregation="composite"/>

Second node:

    <Profile:AND base_Part="EAID_9D13F3CF_4FDB_46bc_B47F_8B4DC9C6DADD"/>

what i am trying to do is that every time the xmi:id of the uml:property matches with the base_Part of the profile i want to save the base_part valeu. In my xslt transformation i have a transformation class for the owned attribute and there i am trying to compare this two values mentioned above. the comparison i am trying to do is smth like this:

<xsl:if test= "@xmi:id= ´EAID_9D13F3CF_4FDB_46bc_B47F_8B4DC9C6DADD'">
                <xsl:sequence
                    select="fn:createAtt('association','9D13F3CF-4FDB-46bc-B47F-8B4DC9C6DADD')" />
            </xsl:if>

Of course with the static values i have putted it works. What i need to know is how to read the base_Part value of the Profile:AND ?

thank you in advance,

Recommended Answers

All 3 Replies

Can you provide a sample output?

With one node matching and one without, so I can see what needs doing exactly. Just needs clarifying in my head :)

The input looks like this:

<xmi:Documentation exporter="Enterprise Architect" exporterVersion="6.5"></xmi:Documentation>
<uml:Model xmi:type="uml:Model" name="EA_Model" visibility="public">
    <packagedElement xmi:type="uml:Package" xmi:id="EAPK_F1F1D84C_4CDE_43f0_AE6F_EA4F772F66BC" name="Model" visibility="public">
        <packagedElement xmi:type="uml:Package" xmi:id="EAPK_525063E8_4FE5_4f9c_A7B8_D3E058E440DF" name="Component Model" visibility="public">
        <packagedElement xmi:type="uml:Component" xmi:id="EAID_07FCD40B_C607_4742_A63D_BA0B0C5DC4F7" name="SpeedSensor1" visibility="public" isIndirectlyInstantiated="true">
                <ownedAttribute xmi:type="uml:Property" 
                     xmi:id="EAID_9D13F3CF_4FDB_46bc_B47F_8B4DC9C6DADD" 
                     name="Part2" 
                     visibility="public" 
                     aggregation="composite"></ownedAttribute>
                </packagedElement> 
        </packagedElement>
    </packagedElement> 
    <CFT:AND base_Part="EAID_9D13F3CF_4FDB_46bc_B47F_8B4DC9C6DADD"></CFT:AND>     
</uml:Model>

And the output looks like this:

   <uml:Model xmi:id="51b839f1-5c87-46d5-9042-b98f2858b252" xmi:type="uml:Model"
              name="EA_Model"
              visibility="public">
      <packagedElement xmi:id="{F1F1D84C-4CDE-43f0-AE6F-EA4F772F66BC}" xmi:type="uml:Package"
                       name="Model"
                       visibility="public">  
                  <ownedAttribute xmi:id="9D13F3CF-4FDB-46bc-B47F-8B4DC9C6DADD" xmi:type="uml:Property"
                                  visibility="public"
                                  name="Part2"
                                 association = "AND"
                                  aggregation="composite"></ownedAttribute>
               </packagedElement>             
   </uml:Model>
   <Profile:AND base_Part="9D13F3CF-4FDB-46bc-B47F-8B4DC9C6DADD"></Profile:AND>

</xmi:XMI>

the files are prety similiar. First one is XML and second is uml. the difference is that iwant to copy the AND of <Profile:AND base_Part="9D13F3CF-4FDB-46bc-B47F-8B4DC9C6DADD"></Profile:AND> to association atttrbitutes when ID matches.

Ok so, if the packagedElement does NOT match a base_part from what I can see we just ignore it?

Or does that also get copied?

The input XML provided also throws up at least two undeclared namespace errors, on xmi and uml, can you provide those declarations, else XSLT will not run on it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.