⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmi.xsl

📁 DelphiDoc is a program for automatic generation of documentation on a Delphi-Project. At the momen
💻 XSL
📖 第 1 页 / 共 2 页
字号:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">



<!-- define general font for the file -->


<xsl:template match="/">
 <html><head></head><body style="font-family:Verdana, Arial, Helv, Helvetica, SansSerif">
  <xsl:apply-templates />
 </body></html>
</xsl:template>

<!-- create the header -->

<xsl:template match="XMI.header">
  <div style="background-color:black; color:yellow">
    <b>XMI Language</b>: 
    <xsl:for-each select="XMI.metamodel">
       <xsl:value-of select="@xmi.name"/>
    </xsl:for-each>
    <br />
    <b>Language Version</b>: 
    <xsl:for-each select="XMI.metamodel">
       <xsl:value-of select="@xmi.version"/>
    </xsl:for-each>
    <br />
    <br />
    <b>Exported by</b>: <xsl:value-of select="XMI.documentation/XMI.exporter"/><br />
    <b>In Version</b>: <xsl:value-of select="XMI.documentation/XMI.exporterVersion"/><br />
  </div>
  <br />
</xsl:template>






<!-- create the most outer block for the whole model -->

<xsl:template match="Model_Management.Model[@xmi.id != '']">
  <div style="background-color:yellow; margin-left:10px">
    <a><xsl:attribute name="name"><xsl:value-of select="@xmi.id" /></xsl:attribute></a>
    <xsl:apply-templates />
  </div>
</xsl:template>




<!-- show the additonal nesting of namespaces 
     not interesting, because all identifiers in the namespace are in it -->
<!-- 

<xsl:template match="Foundation.Core.Namespace.ownedElement">
  <div style="background-color:blue; margin-left:10px">
    <b><font color="white">owned in namespace</font>:</b><br/>
    <xsl:apply-templates />
  </div>
</xsl:template>

-->












<!-- show the (data) type, native no class or interface, or a reference to it -->

<xsl:template match="Foundation.Core.DataType[@xmi.id]">
  <div style="background-color:#404040; color:lightgreen; margin-left:10px">
    <a><xsl:attribute name="name"><xsl:value-of select="@xmi.id" /></xsl:attribute><b>Type:</b> </a>
    <xsl:apply-templates />
  </div>
</xsl:template>

<xsl:template match="Foundation.Core.DataType[@xmi.idref]">
  <a><xsl:attribute name="href">#<xsl:value-of select="@xmi.idref" /></xsl:attribute>
    <xsl:variable name="id" select="@xmi.idref" />
    <xsl:copy-of select="/descendant::*[@xmi.id=$id]/Foundation.Core.ModelElement.name" />
  </a>
</xsl:template>






<!-- create box of the class or interface or create a reference to it  -->

<xsl:template match="Foundation.Core.Class[@xmi.id]">
  <div style="background-color:orange; color:white; margin-left:10px">
    <a><xsl:attribute name="name"><xsl:value-of select="@xmi.id" /></xsl:attribute><b>Eine Klasse:</b> </a>
    <xsl:apply-templates />
  </div>
</xsl:template>

<!-- format name in italic if the class is abstract -->

<xsl:template match="Foundation.Core.Class/Foundation.Core.ModelElement.name">
  <xsl:choose>
    <xsl:when test="../Foundation.Core.GeneralizableElement.isAbstract[@xmi.value = true]">
      <i><xsl:apply-templates /></i>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates />
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template match="Foundation.Core.Class[@xmi.idref]">
  <a><xsl:attribute name="href">#<xsl:value-of select="@xmi.idref" /></xsl:attribute>
    <xsl:variable name="id" select="@xmi.idref" />
    <xsl:copy-of select="/descendant::Foundation.Core.Class[@xmi.id=$id]/Foundation.Core.ModelElement.name" />
  </a>
</xsl:template>

<xsl:template match="Foundation.Core.Interface[@xmi.id]">
  <div style="background-color:#FFB920; color:white; margin-left:10px">
    <a><xsl:attribute name="name"><xsl:value-of select="@xmi.id" /></xsl:attribute><b>Eine Schnittstelle:</b> </a>
    <xsl:apply-templates />
  </div>
</xsl:template>

<xsl:template match="Foundation.Core.Interface[@xmi.idref]">
  <a><xsl:attribute name="href">#<xsl:value-of select="@xmi.idref" /></xsl:attribute>
    <xsl:variable name="id" select="@xmi.idref" />
    <xsl:copy-of select="/descendant::Foundation.Core.Interface[@xmi.id=$id]/Foundation.Core.ModelElement.name" />
  </a>
</xsl:template>





<!-- show the additonal nesting of the members of classes and interfaces
     not interesting, because all identifiers in the namespace are in it -->
<!-- 

<xsl:template match="Foundation.Core.Class/Foundation.Core.Classifier.feature">
  <div style="background-color:white; color:black; margin-left:10px">
    <h6>Members:</h6>
    <xsl:apply-templates />
  </div>
</xsl:template>

<xsl:template match="Foundation.Core.Interface/Foundation.Core.Classifier.feature">
  <div style="background-color:white; color:black; margin-left:10px">
    <h6>Members:</h6>
    <xsl:apply-templates />
  </div>
</xsl:template>


-->





















<!-- show the attributes (fields/members) of classes 
     (and interfaces (at least in Delphi (properties))) -->

<xsl:template match="Foundation.Core.Attribute">
  <div style="background-color:#F0F0F0; color:darkgreen; margin-left:10px">
    <xsl:choose>
      <xsl:when test="@xmi.id != ''">
        <a><xsl:attribute name="name"><xsl:value-of select="@xmi.id" /></xsl:attribute><b>Attribute:</b> </a>
      </xsl:when>
      <xsl:otherwise>
        <a><xsl:attribute name="href">#<xsl:value-of select="@xmi.idref" /></xsl:attribute>Attribute</a>
      </xsl:otherwise>
    </xsl:choose>

    <xsl:apply-templates />
  </div>
</xsl:template>


<!-- separate attribute from its type by a ":" -->

<xsl:template match="Foundation.Core.StructuralFeature.type">
  :
  <xsl:apply-templates />
</xsl:template>

<!-- sometimes another syntax for the reference to the type -->

<xsl:template match="Foundation.Core.StructuralFeature.type/Foundation.Core.Classifier">
 <a><xsl:attribute name="href">#<xsl:value-of select="@xmi.idref" /></xsl:attribute>
     <xsl:variable name="id" select="@xmi.idref" />
     <xsl:copy-of select="/descendant::*[@xmi.id=$id]/Foundation.Core.ModelElement.name" />
  </a>
</xsl:template>


<!-- ignore multiplicity? and tags -->

<xsl:template match="Foundation.Core.StructuralFeature.multiplicity">
</xsl:template>

<xsl:template match="Foundation.Extension_Mechanisms.TaggedValue">
</xsl:template>








<!-- show the attoperationsributes (methods/members) of classes and interfaces -->


<xsl:template match="Foundation.Core.Operation">
  <div style="background-color:#E0E0E0; color:darkred; margin-left:10px">
    <xsl:choose>
      <xsl:when test="@xmi.id != ''">
        <a><xsl:attribute name="name"><xsl:value-of select="@xmi.id" /></xsl:attribute><b>Operation:</b> </a>
      </xsl:when>
      <xsl:otherwise>
        <a><xsl:attribute name="href">#<xsl:value-of select="@xmi.idref" /></xsl:attribute>Operation</a>
      </xsl:otherwise>
    </xsl:choose>

    <xsl:apply-templates />
  </div>
</xsl:template>




<!-- the return type and parameters are formated as a list with correct separators -->


<xsl:template match="Foundation.Core.BehavioralFeature.parameter">

  <xsl:variable name="paramcount" select="count(Foundation.Core.Parameter)"/>
  <xsl:variable name="hasresult" select="Foundation.Core.Parameter/Foundation.Core.Parameter.kind[@xmi.value='return']"/>
  <xsl:variable name="realparamcount">
    <xsl:choose>
      <xsl:when test="$hasresult">
        <xsl:value-of select="$paramcount - 1"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$paramcount"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="resultisfirst" select="Foundation.Core.Parameter[1]/Foundation.Core.Parameter.kind[@xmi.value='return']"/>


  <xsl:if test="$realparamcount &gt; 0">

    (
    <xsl:for-each select="Foundation.Core.Parameter">
      <xsl:if test="not(Foundation.Core.Parameter.kind[@xmi.value='return'])">

        <xsl:choose>
          <xsl:when test="position() = 1"></xsl:when>
          <xsl:when test="position() &gt; 1 and not($hasresult)">; </xsl:when>
          <xsl:when test="position() != 2 or not($resultisfirst)">; </xsl:when>
        </xsl:choose>

        <xsl:apply-templates select="."/>

      </xsl:if>

    </xsl:for-each>
    )

  </xsl:if>



  <xsl:for-each select="Foundation.Core.Parameter/Foundation.Core.Parameter.kind[@xmi.value='return']">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -