Difference between revisions of "Artefact:Template/org/ooem/templates/ooem-1.0-xmi-2.1"

From OOModels
Jump to navigationJump to search
 
(5 intermediate revisions by the same user not shown)
Line 7: Line 7:


== Code ==
== Code ==


<div class="code">
<div class="code">
Line 14: Line 13:
                 xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
                 xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
                 xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
                 xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
                 xmlns="http://www.ooem.org/1.0"
                 xmlns:ooem="http://www.ooem.org/1.0"
                 version="1.0">
                 version="1.0">
   <xsl:output method="xml" indent="yes"/>
   <xsl:output method="xml" indent="yes"/>
Line 21: Line 20:
       <xsl:apply-templates/>
       <xsl:apply-templates/>
   </xsl:template>
   </xsl:template>
 
   <xsl:template match="Package">
   <xsl:template match="ooem:Package">
     <xsl:variable name="name" select="Name"/>
     <xsl:variable name="name" select="ooem:Name"/>
     <uml:Package xmi:version="2.1" xmi:id="p_{$name}" name="{$name}">
     <uml:Package xmi:version="2.1" xmi:id="p_{$name}" name="{$name}">
       <xsl:apply-templates select="Class">
       <xsl:apply-templates select="ooem:Class">
         <xsl:with-param name="prefix"><xsl:value-of select="'p_'+$name"/></xsl:with-param>
         <xsl:with-param name="prefix"><xsl:value-of select="concat('p_',$name)"/></xsl:with-param>
       </xsl:apply-templates>
       </xsl:apply-templates>
     </uml:Package>
     </uml:Package>
   </xsl:template>
   </xsl:template>
   
   
   <xsl:template match="Class">
   <xsl:template match="ooem:Class">
     <xsl:param name="prefix"></xsl:param>
     <xsl:param name="prefix"></xsl:param>
     <xsl:variable name="name" select="Name"/>
     <xsl:variable name="name" select="ooem:Name"/>
     <packagedElement xmi:type="uml:Class" xmi:id="{$prefix}_c_{$name}" name="{$name}">
     <packagedElement xmi:type="uml:Class" xmi:id="{$prefix}_c_{$name}" name="{$name}">
       <xsl:apply-templates select="Attribute">
       <xsl:apply-templates select="*">
         <xsl:with-param name="prefix"><xsl:value-of select="$prefix+'_c_'+$name"/></xsl:with-param>
         <xsl:with-param name="prefix"><xsl:value-of select="concat($prefix,'_c_',$name)"/></xsl:with-param>
      </xsl:apply-templates>
      <xsl:apply-templates select="ooem:Operation">
        <xsl:with-param name="prefix"><xsl:value-of select="concat($prefix,'_c_',$name)"/></xsl:with-param>
       </xsl:apply-templates>
       </xsl:apply-templates>
     </packagedElement>
     </packagedElement>
   </xsl:template>
   </xsl:template>
   
   
   <xsl:template match="Attribute">
   <xsl:template match="ooem:Attribute">
     <xsl:param name="prefix"></xsl:param>
     <xsl:param name="prefix"></xsl:param>
     <xsl:variable name="name" select="Name"/>
     <xsl:variable name="name" select="@Name"/>
     <ownedAttribute xmi:id="{$prefix}_a_{$name}" name="{$name}" aggregation="composite"/>
     <ownedAttribute xmi:id="{$prefix}_a_{$name}" name="{$name}" aggregation="composite"/>
   </xsl:template>
   </xsl:template>
   
   
   <xsl:template match="Operation">
   <xsl:template match="ooem:Operation">
     <xsl:param name="prefix"></xsl:param>
     <xsl:param name="prefix"></xsl:param>
     <xsl:variable name="name" select="Name"/>
     <xsl:variable name="name" select="@Name"/>
     <ownedAttribute xmi:id="{$prefix}_o_{$name}" name="{$name}" aggregation="composite"/>
     <ownedAttribute xmi:id="{$prefix}_o_{$name}" name="{$name}" aggregation="composite"/>
   </xsl:template>
   </xsl:template>
   
   
   <xsl:template match="*">
   <xsl:template match="*">
     hallo <xsl:value-of select="name()"/>
     <!-- <xsl:value-of select="name()"/> -->
   </xsl:template>
   </xsl:template>
   
   
  </xsl:stylesheet>
  </xsl:stylesheet>
</div>
</div>

Latest revision as of 21:27, 9 July 2008

Classification
Type Type:org/w3/XSL
Domain Domain:it/development/formatting
Category Type:org/oomodels/wiki/Template
Maturity work in progress
Namespace (more)

OOEM main package

create new pages

Code[edit]

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
                xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML"
                xmlns:ooem="http://www.ooem.org/1.0"
                version="1.0">
  <xsl:output method="xml" indent="yes"/>

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

  <xsl:template match="ooem:Package">
    <xsl:variable name="name" select="ooem:Name"/>
    <uml:Package xmi:version="2.1" xmi:id="p_{$name}" name="{$name}">
      <xsl:apply-templates select="ooem:Class">
        <xsl:with-param name="prefix"><xsl:value-of select="concat('p_',$name)"/></xsl:with-param>
      </xsl:apply-templates>
    </uml:Package>
  </xsl:template>

  <xsl:template match="ooem:Class">
    <xsl:param name="prefix"></xsl:param>
    <xsl:variable name="name" select="ooem:Name"/>
    <packagedElement xmi:type="uml:Class" xmi:id="{$prefix}_c_{$name}" name="{$name}">
      <xsl:apply-templates select="*">
        <xsl:with-param name="prefix"><xsl:value-of select="concat($prefix,'_c_',$name)"/></xsl:with-param>
      </xsl:apply-templates>
      <xsl:apply-templates select="ooem:Operation">
        <xsl:with-param name="prefix"><xsl:value-of select="concat($prefix,'_c_',$name)"/></xsl:with-param>
      </xsl:apply-templates>
    </packagedElement>
  </xsl:template>

  <xsl:template match="ooem:Attribute">
    <xsl:param name="prefix"></xsl:param>
    <xsl:variable name="name" select="@Name"/>
    <ownedAttribute xmi:id="{$prefix}_a_{$name}" name="{$name}" aggregation="composite"/>
  </xsl:template>

  <xsl:template match="ooem:Operation">
    <xsl:param name="prefix"></xsl:param>
    <xsl:variable name="name" select="@Name"/>
    <ownedAttribute xmi:id="{$prefix}_o_{$name}" name="{$name}" aggregation="composite"/>
  </xsl:template>

  <xsl:template match="*">
  </xsl:template>

</xsl:stylesheet>