📄 portnamecompartment.xsl
字号:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Template: PortNameCompartment.xsl
Displays Ports PortNameCompartment
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/2000/svg" xmlns:UML="org.omg.xmi.namespace.UML">
<xsl:import href="../Common/Styling.xsl"/>
<xsl:import href="../Common/StringTSpan.xsl"/>
<xsl:import href="../Common/Multiplicity.xsl"/>
<xsl:output media-type="image/svg+xml" method="xml" indent="yes"/>
<!-- PortNameCompartment -->
<xsl:template name="PortNameCompartment">
<xsl:param name="DiagramID" select="@xmi.id"/>
<xsl:param name="SemanticID" select="../../UML:GraphElement.semanticModel/UML:Uml1SemanticModelBridge/UML:Uml1SemanticModelBridge.element/*/@xmi.idref"/>
<!-- Main PortNameCompartment group -->
<g transform="translate({UML:GraphElement.position/XMI.field[1]}, {UML:GraphElement.position/XMI.field[2]})" id="{$DiagramID}">
<xsl:apply-templates select="." mode="FontStyle"/>
<xsl:apply-templates select="." mode="isVisible"/>
<desc><xsl:text>PortNameCompartment</xsl:text></desc>
<!-- PortName text -->
<text stroke="none" baseline-shift="-100%">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode">
<xsl:choose>
<xsl:when test="UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'Name'">
<!-- Port Name -->
<xsl:call-template name="StringTSpan">
<xsl:with-param name="SemanticID" select="$SemanticID" />
<xsl:with-param name="String">
<xsl:value-of select="key('xmi.id', $SemanticID)/@name"/>
</xsl:with-param>
<xsl:with-param name="x" select="UML:GraphElement.position/XMI.field[1]" />
<xsl:with-param name="y" select="UML:GraphElement.position/XMI.field[2]" />
</xsl:call-template>
</xsl:when>
<xsl:when test="UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'TypeSeparator'">
<!-- Name/Type separator, ':' -->
<tspan x="{UML:GraphElement.position/XMI.field[1]}" y="{UML:GraphElement.position/XMI.field[2]}"><xsl:text>:</xsl:text></tspan>
</xsl:when>
<xsl:when test="UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'StructuralFeatureType'">
<!-- Port Type -->
<xsl:variable name="basex" select="UML:GraphElement.position/XMI.field[1]" />
<xsl:variable name="basey" select="UML:GraphElement.position/XMI.field[2]" />
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode">
<xsl:variable name="TypeSemanticID" select="UML:GraphElement.semanticModel/UML:Uml1SemanticModelBridge/UML:Uml1SemanticModelBridge.element/*/@xmi.idref" />
<xsl:call-template name="StringTSpan">
<xsl:with-param name="SemanticID" select="$TypeSemanticID" />
<xsl:with-param name="String">
<xsl:value-of select="key('xmi.id', $TypeSemanticID)/@name"/>
</xsl:with-param>
<xsl:with-param name="x" select="UML:GraphElement.position/XMI.field[1] + $basex" />
<xsl:with-param name="y" select="UML:GraphElement.position/XMI.field[2] + $basey" />
</xsl:call-template>
</xsl:for-each>
</xsl:when>
<xsl:when test="UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'MultiplicityStart'">
<!-- Multiplicity start, '[' -->
<tspan x="{UML:GraphElement.position/XMI.field[1]}" y="{UML:GraphElement.position/XMI.field[2]}"><xsl:text>[</xsl:text></tspan>
</xsl:when>
<xsl:when test="UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'Multiplicity'">
<!-- Multiplicity -->
<tspan x="{UML:GraphElement.position/XMI.field[1]}" y="{UML:GraphElement.position/XMI.field[2]}">
<xsl:call-template name="Multiplicity">
<xsl:with-param name="SemanticID" select="$SemanticID"/>
</xsl:call-template>
</tspan>
</xsl:when>
<xsl:when test="UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'MultiplicityEnd'">
<!-- Multiplicity end, ']' -->
<tspan x="{UML:GraphElement.position/XMI.field[1]}" y="{UML:GraphElement.position/XMI.field[2]}"><xsl:text>]</xsl:text></tspan>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</text>
</g>
</xsl:template>
</xsl:stylesheet>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -