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

📄 diagramsize.xsl

📁 Copyright&copy 2004 Sergiu Dumitriu, Marta G&icirc rdea, C&#259 t&#259 lin Hri&#355 cu Permission is
💻 XSL
📖 第 1 页 / 共 3 页
字号:
								<xsl:sort select="UML:GraphElement.position/XMI.field[1] + $PortX + ../../../../UML:GraphElement.position/XMI.field[1] + ../../UML:GraphElement.position/XMI.field[1] + UML:GraphNode.size/XMI.field[1]" data-type="number" order="descending"/>
								<xsl:if test="position() = 1">
									<xsl:value-of select="UML:GraphElement.position/XMI.field[1] + $PortX + ../../UML:GraphElement.position/XMI.field[1] + ../../../../UML:GraphElement.position/XMI.field[1] + UML:GraphNode.size/XMI.field[1]"/>
								</xsl:if>
							</xsl:for-each>
						</xsl:variable>
						<xsl:variable name="InterfaceEdge">
							<xsl:for-each select="UML:GraphElement.contained/UML:GraphEdge[@isVisible='true']/UML:GraphEdge.waypoints/XMI.field[position() mod 3 = 1]/XMI.field[1]">
								<xsl:sort select=". + $PortX" data-type="number" order="descending"/>
								<xsl:if test="position() = 1">
									<xsl:value-of select=". + $PortX "/>
								</xsl:if>
							</xsl:for-each>
						</xsl:variable>

						<xsl:variable name="MaxPortX0">
							<xsl:choose>
								<xsl:when test="($PortName = '') or ($PortBody &gt;= $PortName)"><xsl:value-of select="$PortBody"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="$PortName"/></xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="MaxPortX1">
							<xsl:choose>
								<xsl:when test="($InterfaceNode = '') or ($MaxPortX0 &gt;= $InterfaceNode)"><xsl:value-of select="$MaxPortX0"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="$InterfaceNode"/></xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="MaxPortX2">
							<xsl:choose>
								<xsl:when test="($InterfaceText = '') or ($MaxPortX1 &gt;= $InterfaceText)"><xsl:value-of select="$MaxPortX1"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="$InterfaceText"/></xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="MaxPortX3">
							<xsl:choose>
								<xsl:when test="($InterfaceEdge = '') or ($MaxPortX2 &gt;= $InterfaceEdge)"><xsl:value-of select="$MaxPortX2"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="$InterfaceEdge"/></xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:value-of select="$MaxPortX3"/>
					</xsl:if>
				</xsl:for-each>
			</xsl:variable>
			<xsl:variable name="RestMaxX">
				<xsl:call-template name="PortMaxX">
					<xsl:with-param name="Position" select="$Position + 1"/>
				</xsl:call-template>
			</xsl:variable>

			<xsl:choose>
				<xsl:when test="($RestMaxX = '') or ($MyMaxX &gt;= $RestMaxX)"><xsl:value-of select="$MyMaxX"/></xsl:when>
				<xsl:otherwise><xsl:value-of select="$RestMaxX"/></xsl:otherwise>
			</xsl:choose>
		</xsl:if>
	</xsl:template>

	<xsl:template name="PortMinY">
		<xsl:param name="Position" select="1"/>

		<xsl:if test="$Position &lt;= count(.//UML:GraphElement.contained/UML:GraphNode[UML:GraphElement.semanticModel//UML:Attribute])">
			<xsl:variable name="MyMinY">
				<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible='true' and UML:GraphElement.semanticModel//UML:Attribute]">
					<xsl:if test="position() = $Position">
						<xsl:variable name="ComponentY" select="../../UML:GraphElement.position/XMI.field[2]"/>
						<xsl:variable name="PortY" select="number($ComponentY) + number(UML:GraphElement.position/XMI.field[2])"/>
						<xsl:variable name="PortBody">
							<xsl:value-of select="$PortY"/>
						</xsl:variable>
						<xsl:variable name="PortName">
							<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible='true' and (UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'PortNameCompartment')]">
								<xsl:value-of select="$PortY + UML:GraphElement.position/XMI.field[2]"/>
							</xsl:for-each>
						</xsl:variable>
						<xsl:variable name="InterfaceNode">
							<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true' and (UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'ProvidedInterfaceNode' or UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'RequiredInterfaceNode')]/UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true']">
								<xsl:sort select="UML:GraphElement.position/XMI.field[2] + ../../UML:GraphElement.position/XMI.field[2] + $PortY" data-type="number" order="ascending"/>
								<xsl:if test="position() = 1">
									<xsl:value-of select="UML:GraphElement.position/XMI.field[2] + ../../UML:GraphElement.position/XMI.field[2] + $PortY"/>
								</xsl:if>
							</xsl:for-each>
						</xsl:variable>
						<xsl:variable name="InterfaceText">
							<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true' and (UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'ProvidedInterfaceNode' or UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'RequiredInterfaceNode')]/UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true']/UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true']">
								<xsl:sort select="UML:GraphElement.position/XMI.field[2] + $PortY + ../../../../UML:GraphElement.position/XMI.field[2] + ../../UML:GraphElement.position/XMI.field[2]" data-type="number" order="ascending"/>
								<xsl:if test="position() = 1">
									<xsl:value-of select="UML:GraphElement.position/XMI.field[2] + $PortY + ../../UML:GraphElement.position/XMI.field[2] + ../../../../UML:GraphElement.position/XMI.field[2]"/>
								</xsl:if>
							</xsl:for-each>
						</xsl:variable>
						<xsl:variable name="InterfaceEdge">
							<xsl:for-each select="UML:GraphElement.contained/UML:GraphEdge[@isVisible='true']/UML:GraphEdge.waypoints/XMI.field[position() mod 3 = 1]/XMI.field[2]">
								<xsl:sort select=". + $PortY" data-type="number" order="ascending"/>
								<xsl:if test="position() = 1">
									<xsl:value-of select=". + $PortY "/>
								</xsl:if>
							</xsl:for-each>
						</xsl:variable>

						<xsl:variable name="MinPortY0">
							<xsl:choose>
								<xsl:when test="($PortName = '') or ($PortBody &lt;= $PortName)"><xsl:value-of select="$PortBody"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="$PortName"/></xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="MinPortY1">
							<xsl:choose>
								<xsl:when test="($InterfaceNode = '') or ($MinPortY0 &lt;= $InterfaceNode)"><xsl:value-of select="$MinPortY0"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="$InterfaceNode"/></xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="MinPortY2">
							<xsl:choose>
								<xsl:when test="($InterfaceText = '') or ($MinPortY1 &lt;= $InterfaceText)"><xsl:value-of select="$MinPortY1"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="$InterfaceText"/></xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="MinPortY3">
							<xsl:choose>
								<xsl:when test="($InterfaceEdge = '') or ($MinPortY2 &lt;= $InterfaceEdge)"><xsl:value-of select="$MinPortY2"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="$InterfaceEdge"/></xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:value-of select="$MinPortY3"/>
					</xsl:if>
				</xsl:for-each>
			</xsl:variable>
			<xsl:variable name="RestMinY">
				<xsl:call-template name="PortMinY">
					<xsl:with-param name="Position" select="$Position + 1"/>
				</xsl:call-template>
			</xsl:variable>

			<xsl:choose>
				<xsl:when test="($RestMinY = '') or ($MyMinY &lt;= $RestMinY)"><xsl:value-of select="$MyMinY"/></xsl:when>
				<xsl:otherwise><xsl:value-of select="$RestMinY"/></xsl:otherwise>
			</xsl:choose>
		</xsl:if>
	</xsl:template>

	<xsl:template name="PortMaxY">
		<xsl:param name="Position" select="1"/>

		<xsl:if test="$Position &lt;= count(.//UML:GraphElement.contained/UML:GraphNode[UML:GraphElement.semanticModel//UML:Attribute])">
			<xsl:variable name="MyMaxY">
				<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible='true' and UML:GraphElement.semanticModel//UML:Attribute]">
					<xsl:if test="position() = $Position">
						<xsl:variable name="ComponentY" select="../../UML:GraphElement.position/XMI.field[2]"/>
						<xsl:variable name="PortY" select="number($ComponentY) + number(UML:GraphElement.position/XMI.field[2])"/>
						<xsl:variable name="PortBody">
							<xsl:value-of select="$PortY + UML:GraphNode.size/XMI.field[2]"/>
						</xsl:variable>
						<xsl:variable name="PortName">
							<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible='true' and (UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'PortNameCompartment')]">
								<xsl:value-of select="$PortY + UML:GraphElement.position/XMI.field[2] + UML:GraphNode.size/XMI.field[2]"/>
							</xsl:for-each>
						</xsl:variable>
						<xsl:variable name="InterfaceNode">
							<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true' and (UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'ProvidedInterfaceNode' or UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'RequiredInterfaceNode')]/UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true']">
								<xsl:sort select="UML:GraphElement.position/XMI.field[2] + ../../UML:GraphElement.position/XMI.field[2] + $PortY + UML:GraphNode.size/XMI.field[2]" data-type="number" order="descending"/>
								<xsl:if test="position() = 1">
									<xsl:value-of select="UML:GraphElement.position/XMI.field[2] + ../../UML:GraphElement.position/XMI.field[2] + $PortY + UML:GraphNode.size/XMI.field[2]"/>
								</xsl:if>
							</xsl:for-each>
						</xsl:variable>
						<xsl:variable name="InterfaceText">
							<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true' and (UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'ProvidedInterfaceNode' or UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'RequiredInterfaceNode')]/UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true']/UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true']">
								<xsl:sort select="UML:GraphElement.position/XMI.field[2] + $PortY + ../../../../UML:GraphElement.position/XMI.field[2] + ../../UML:GraphElement.position/XMI.field[2] + UML:GraphNode.size/XMI.field[2]" data-type="number" order="descending"/>
								<xsl:if test="position() = 1">
									<xsl:value-of select="UML:GraphElement.position/XMI.field[2] + $PortY + ../../UML:GraphElement.position/XMI.field[2] + ../../../../UML:GraphElement.position/XMI.field[2] + UML:GraphNode.size/XMI.field[2]"/>
								</xsl:if>
							</xsl:for-each>
						</xsl:variable>
						<xsl:variable name="InterfaceEdge">
							<xsl:for-each select="UML:GraphElement.contained/UML:GraphEdge[@isVisible='true']/UML:GraphEdge.waypoints/XMI.field[position() mod 3 = 1]/XMI.field[2]">
								<xsl:sort select=". + $PortY" data-type="number" order="descending"/>
								<xsl:if test="position() = 1">
									<xsl:value-of select=". + $PortY"/>
								</xsl:if>
							</xsl:for-each>
						</xsl:variable>

						<xsl:variable name="MaxPortY0">
							<xsl:choose>
								<xsl:when test="($PortName = '') or ($PortBody &gt;= $PortName)"><xsl:value-of select="$PortBody"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="$PortName"/></xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="MaxPortY1">
							<xsl:choose>
								<xsl:when test="($InterfaceNode = '') or ($MaxPortY0 &gt;= $InterfaceNode)"><xsl:value-of select="$MaxPortY0"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="$InterfaceNode"/></xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="MaxPortY2">
							<xsl:choose>
								<xsl:when test="($InterfaceText = '') or ($MaxPortY1 &gt;= $InterfaceText)"><xsl:value-of select="$MaxPortY1"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="$InterfaceText"/></xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:variable name="MaxPortY3">
							<xsl:choose>
								<xsl:when test="($InterfaceEdge = '') or ($MaxPortY2 &gt;= $InterfaceEdge)"><xsl:value-of select="$MaxPortY2"/></xsl:when>
								<xsl:otherwise><xsl:value-of select="$InterfaceEdge"/></xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<xsl:value-of select="$MaxPortY3"/>
					</xsl:if>
				</xsl:for-each>
			</xsl:variable>
			<xsl:variable name="RestMaxY">
				<xsl:call-template name="PortMaxY">
					<xsl:with-param name="Position" select="$Position + 1"/>
				</xsl:call-template>
			</xsl:variable>

			<xsl:choose>
				<xsl:when test="($RestMaxY = '') or ($MyMaxY &gt;= $RestMaxY)"><xsl:value-of select="$MyMaxY"/></xsl:when>
				<xsl:otherwise><xsl:value-of select="$RestMaxY"/></xsl:otherwise>
			</xsl:choose>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>

⌨️ 快捷键说明

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