diff options
author | Sunil Shetye | 2025-05-02 17:48:45 +0530 |
---|---|---|
committer | Sunil Shetye | 2025-05-05 16:13:10 +0530 |
commit | 838bf6d7d9a5c2d5b807e8f59ce392e44ed99ce0 (patch) | |
tree | 2b684e2b32b595bfa22de2cae6e92f7376ef2515 | |
parent | 5d39e4a6b55d106efdfe3fe70a010af36a17acad (diff) | |
download | Common-Interface-Project-838bf6d7d9a5c2d5b807e8f59ce392e44ed99ce0.tar.gz Common-Interface-Project-838bf6d7d9a5c2d5b807e8f59ce392e44ed99ce0.tar.bz2 Common-Interface-Project-838bf6d7d9a5c2d5b807e8f59ce392e44ed99ce0.zip |
reformat with folding markers
-rw-r--r-- | blocks/eda-frontend/public/geometry.xsl | 1128 | ||||
-rw-r--r-- | blocks/eda-frontend/public/splitblock.xsl | 2 |
2 files changed, 582 insertions, 548 deletions
diff --git a/blocks/eda-frontend/public/geometry.xsl b/blocks/eda-frontend/public/geometry.xsl index 260c64e7..185bd6d8 100644 --- a/blocks/eda-frontend/public/geometry.xsl +++ b/blocks/eda-frontend/public/geometry.xsl @@ -11,583 +11,617 @@ </xsl:copy> </xsl:template> <!-- }}}1 --> + <xsl:key name="k-cell" match="mxCell" use="@id" /> -<xsl:template match="mxPoint[@as='sourcePoint']"> + <xsl:template name="get-port"> + <xsl:param name="style" /> + + <xsl:choose> + <xsl:when test="contains($style, ';')"> + <xsl:value-of select="substring-before($style, ';')" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$style" /> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="get-noofports"> + <xsl:param name="port" /> + <xsl:param name="context" /> + + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="$context/@explicitInputPorts + $context/@implicitInputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="$context/@explicitOutputPorts + $context/@implicitOutputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="$context/@controlPorts" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="$context/@commandPorts" /> + </xsl:when> + </xsl:choose> + </xsl:template> + + <!-- sourcePoint {{{2 --> + <xsl:template match="mxPoint[@as='sourcePoint']"> <xsl:copy> <xsl:apply-templates select="@*" /> - - <!-- variable newx --> - <xsl:variable name="newx"> - <!-- <xsl:choose> - <xsl:when test="(@x != '0.0' or @y != '0.0')"> - <xsl:value-of select="@x"/> - </xsl:when> - <xsl:when test="(@x = '0.0' and @y = '0.0')"> --> - <!-- Check for mxCell with sourceVertex --> - - <xsl:for-each select="key('k-cell', ancestor::mxCell/@sourceVertex)"> - <xsl:variable name="ordering"> - <xsl:value-of select="@ordering"/> - </xsl:variable> - - <xsl:variable name="port" select="substring-before(@style, ';')"/> - - <!-- Find the mxCell whose id matches sourceVertex --> - <xsl:for-each select="key('k-cell', @ParentComponent)"> - <xsl:variable name="noofport"> - <xsl:choose> - <xsl:when test="$port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort'"> - <xsl:value-of select="@implicitOutputPorts + @explicitOutputPorts" /> - </xsl:when> - <xsl:when test="$port = 'ImplicitInputPort' or $port = 'ExplicitInputPort'"> - <xsl:value-of select="@implicitInputPorts + @explicitInputPorts" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort'"> - <xsl:value-of select="@commandPorts" /> - </xsl:when> - <xsl:when test="$port = 'ControlPort'"> - <xsl:value-of select="@controlPorts" /> - </xsl:when> - </xsl:choose> - </xsl:variable> - - <xsl:for-each select="mxGeometry"> - - <xsl:choose> - <xsl:when test="$port = 'ImplicitInputPort' or $port = 'ExplicitInputPort'"> - <xsl:value-of select="@x" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort' or $port = 'ControlPort'"> - <xsl:value-of select="(@x + @width * (2 * $ordering -1) div (2 * $noofport))" /> - </xsl:when> - <xsl:when test="$port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort'"> - <xsl:value-of select="@x + @width" /> - </xsl:when> - - </xsl:choose> - - </xsl:for-each> - - </xsl:for-each> + + <!-- x {{{ --> + <xsl:variable name="newx"> + <!-- Get mxCell with sourceVertex of parent --> + <xsl:for-each select="key('k-cell', ancestor::mxCell/@sourceVertex)"> + <!-- Get the port number for calculating position --> + <xsl:variable name="ordering"> + <xsl:value-of select="@ordering" /> + </xsl:variable> + + <!-- Get the port type from the style attribute --> + <xsl:variable name="port"> + <xsl:choose> + <xsl:when test="contains(@style, ';')"> + <xsl:value-of select="substring-before(@style, ';')" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@style" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Get parent mxCell with port count --> + <xsl:for-each select="key('k-cell', @ParentComponent)"> + <!-- Get the number of ports for calculating position --> + <xsl:variable name="noofport"> + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="@controlPorts" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="@commandPorts" /> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:for-each select="mxGeometry"> + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="@x" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="@x + @width" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort' or $port = 'CommandPort'"> + <xsl:value-of select="@x + @width * (2 * $ordering - 1) div (2 * $noofport)" /> + </xsl:when> + </xsl:choose> </xsl:for-each> - - <!-- </xsl:when> - </xsl:choose> --> - </xsl:variable> - <xsl:variable name="newy"> - <!-- <xsl:choose> - <xsl:when test="(@x != '0.0' or @y != '0.0')"> - <xsl:value-of select="@y"/> - </xsl:when> - <xsl:when test="(@x = '0.0' and @y = '0.0')"> --> - <!-- Check for mxCell with sourceVertex --> - <xsl:for-each select="key('k-cell', ancestor::mxCell/@sourceVertex)"> - <xsl:variable name="ordering"> - <xsl:value-of select="@ordering"/> - </xsl:variable> - - <xsl:variable name="port" select="substring-before(@style, ';')"/> - - <!-- Find the mxCell whose id matches sourceVertex --> - <xsl:for-each select="key('k-cell', @ParentComponent)"> - <xsl:variable name="noofport"> - <xsl:choose> - <xsl:when test="$port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort'"> - <xsl:value-of select="@implicitOutputPorts + @explicitOutputPorts" /> - </xsl:when> - <xsl:when test="$port = 'ImplicitInputPort' or $port = 'ExplicitInputPort'"> - <xsl:value-of select="@implicitInputPorts + @explicitInputPorts" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort'"> - <xsl:value-of select="@commandPorts" /> - </xsl:when> - <xsl:when test="$port = 'ControlPort'"> - <xsl:value-of select="@controlPorts" /> - </xsl:when> - </xsl:choose> - </xsl:variable> - - <xsl:for-each select="mxGeometry"> - <xsl:choose> - <xsl:when test="($port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort') or ($port = 'ImplicitInputPort' or $port = 'ExplicitInputPort')"> - <xsl:value-of select="(@y + @height * (2 * $ordering - 1) div (2 * $noofport))" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort'"> - <xsl:value-of select="@y + @height" /> - </xsl:when> - <xsl:when test="$port = 'ControlPort'"> - <xsl:value-of select="@y" /> - </xsl:when> - - </xsl:choose> - </xsl:for-each> - - </xsl:for-each> + </xsl:for-each> + </xsl:for-each> + </xsl:variable> + + <xsl:attribute name="x"> + <xsl:choose> + <xsl:when test="$newx = ''"> + <xsl:value-of select="@x" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$newx" /> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <!-- }}} --> + + <!-- y {{{ --> + <xsl:variable name="newy"> + <!-- Get mxCell with sourceVertex of parent --> + <xsl:for-each select="key('k-cell', ancestor::mxCell/@sourceVertex)"> + <!-- Get the port number for calculating position --> + <xsl:variable name="ordering"> + <xsl:value-of select="@ordering" /> + </xsl:variable> + + <!-- Get the port type from the style attribute --> + <xsl:variable name="port"> + <xsl:choose> + <xsl:when test="contains(@style, ';')"> + <xsl:value-of select="substring-before(@style, ';')" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@style" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Get parent mxCell with port count --> + <xsl:for-each select="key('k-cell', @ParentComponent)"> + <!-- Get the number of ports for calculating position --> + <xsl:variable name="noofport"> + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="@controlPorts" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="@commandPorts" /> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:for-each select="mxGeometry"> + <xsl:choose> + <xsl:when test="($port = 'ExplicitInputPort' or $port = 'ImplicitInputPort') or ($port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort')"> + <xsl:value-of select="@y + @height * (2 * $ordering - 1) div (2 * $noofport)" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="@y" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="@y + @height" /> + </xsl:when> + </xsl:choose> </xsl:for-each> - - <!-- </xsl:when> - </xsl:choose> --> - </xsl:variable> - <xsl:attribute name="x"> - <xsl:choose> - <xsl:when test="$newx = ''"> - <xsl:value-of select="@x"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$newx"/> - </xsl:otherwise> - </xsl:choose> - </xsl:attribute> - <xsl:attribute name="y"> + </xsl:for-each> + </xsl:for-each> + </xsl:variable> + + <xsl:attribute name="y"> <xsl:choose> - <xsl:when test="$newy = ''"> - <xsl:value-of select="@y"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$newy"/> - </xsl:otherwise> - </xsl:choose> - </xsl:attribute> - <xsl:apply-templates select="node()" /> + <xsl:when test="$newy = ''"> + <xsl:value-of select="@y" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$newy" /> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <!-- }}} --> + <xsl:apply-templates select="node()" /> </xsl:copy> -</xsl:template> + </xsl:template> + <!-- }}}2 --> -<!-- targetpoint --> -<xsl:template match="mxPoint[@as='targetPoint']"> + <!-- targetpoint {{{3 --> + <xsl:template match="mxPoint[@as='targetPoint']"> <xsl:copy> <xsl:apply-templates select="@*" /> - - <!-- variable newx --> - <xsl:variable name="newx"> - <!-- <xsl:choose> - <xsl:when test="(@x != '0.0' or @y != '0.0')"> - <xsl:value-of select="@x"/> - </xsl:when> - <xsl:when test="(@x = '0.0' and @y = '0.0')"> --> - <!-- Check for mxCell with sourceVertex --> - - <xsl:for-each select="key('k-cell', ancestor::mxCell/@targetVertex)"> - <xsl:variable name="ordering"> - <xsl:value-of select="@ordering"/> - </xsl:variable> - - <xsl:variable name="port" select="substring-before(@style, ';')"/> - - <!-- Find the mxCell whose id matches sourceVertex --> - <xsl:for-each select="key('k-cell', @ParentComponent)"> - <xsl:variable name="noofport"> - <xsl:choose> - <xsl:when test="$port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort'"> - <xsl:value-of select="@implicitOutputPorts + @explicitOutputPorts" /> - </xsl:when> - <xsl:when test="$port = 'ImplicitInputPort' or $port = 'ExplicitInputPort'"> - <xsl:value-of select="@implicitInputPorts + @explicitInputPorts" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort'"> - <xsl:value-of select="@commandPorts" /> - </xsl:when> - <xsl:when test="$port = 'ControlPort'"> - <xsl:value-of select="@controlPorts" /> - </xsl:when> - </xsl:choose> - </xsl:variable> - - <xsl:for-each select="mxGeometry"> - - <xsl:choose> - <xsl:when test="$port = 'ImplicitInputPort' or $port = 'ExplicitInputPort'"> - <xsl:value-of select="@x" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort' or $port = 'ControlPort'"> - <xsl:value-of select="(@x + @width * (2 * $ordering -1) div (2 * $noofport))" /> - </xsl:when> - <xsl:when test="$port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort'"> - <xsl:value-of select="@x + @width" /> - </xsl:when> - - </xsl:choose> - </xsl:for-each> - - </xsl:for-each> + + <!-- x {{{ --> + <xsl:variable name="newx"> + <!-- Get mxCell with targetVertex of parent --> + <xsl:for-each select="key('k-cell', ancestor::mxCell/@targetVertex)"> + <!-- Get the port number for calculating position --> + <xsl:variable name="ordering"> + <xsl:value-of select="@ordering" /> + </xsl:variable> + + <!-- Get the port type from the style attribute --> + <xsl:variable name="port"> + <xsl:choose> + <xsl:when test="contains(@style, ';')"> + <xsl:value-of select="substring-before(@style, ';')" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@style" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Get parent mxCell with port count --> + <xsl:for-each select="key('k-cell', @ParentComponent)"> + <!-- Get the number of ports for calculating position --> + <xsl:variable name="noofport"> + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="@controlPorts" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="@commandPorts" /> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:for-each select="mxGeometry"> + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="@x" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="@x + @width" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort' or $port = 'CommandPort'"> + <xsl:value-of select="@x + @width * (2 * $ordering - 1) div (2 * $noofport)" /> + </xsl:when> + </xsl:choose> </xsl:for-each> - - <!-- </xsl:when> - </xsl:choose> --> - </xsl:variable> - <xsl:variable name="newy"> - <!-- <xsl:choose> - <xsl:when test="(@x != '0.0' or @y != '0.0')"> - <xsl:value-of select="@y"/> - </xsl:when> - <xsl:when test="(@x = '0.0' and @y = '0.0')"> --> - <!-- Check for mxCell with targetVertex --> - <xsl:for-each select="key('k-cell', ancestor::mxCell/@targetVertex)"> - <xsl:variable name="ordering"> - <xsl:value-of select="@ordering"/> - </xsl:variable> - - <xsl:variable name="port" select="substring-before(@style, ';')"/> - - <!-- Find the mxCell whose id matches targetVertex --> - <xsl:for-each select="key('k-cell', @ParentComponent)"> - <xsl:variable name="noofport"> - <xsl:choose> - <xsl:when test="$port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort'"> - <xsl:value-of select="@implicitOutputPorts + @explicitOutputPorts" /> - </xsl:when> - <xsl:when test="$port = 'ImplicitInputPort' or $port = 'ExplicitInputPort'"> - <xsl:value-of select="@implicitInputPorts + @explicitInputPorts" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort'"> - <xsl:value-of select="@commandPorts" /> - </xsl:when> - <xsl:when test="$port = 'ControlPort'"> - <xsl:value-of select="@controlPorts" /> - </xsl:when> - </xsl:choose> - </xsl:variable> - - <xsl:for-each select="mxGeometry"> - <xsl:choose> - <xsl:when test="($port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort') or ($port = 'ImplicitInputPort' or $port = 'ExplicitInputPort')"> - <xsl:value-of select="(@y + @height * (2 * $ordering - 1) div (2 * $noofport))" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort'"> - <xsl:value-of select="@y + @height" /> - </xsl:when> - <xsl:when test="$port = 'ControlPort'"> - <xsl:value-of select="@y" /> - </xsl:when> - - </xsl:choose> - </xsl:for-each> - - </xsl:for-each> + </xsl:for-each> + </xsl:for-each> + </xsl:variable> + + <xsl:attribute name="x"> + <xsl:choose> + <xsl:when test="$newx = ''"> + <xsl:value-of select="@x" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$newx" /> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <!-- }}} --> + + <!-- y {{{ --> + <xsl:variable name="newy"> + <!-- Get mxCell with targetVertex of parent --> + <xsl:for-each select="key('k-cell', ancestor::mxCell/@targetVertex)"> + <!-- Get the port number for calculating position --> + <xsl:variable name="ordering"> + <xsl:value-of select="@ordering" /> + </xsl:variable> + + <!-- Get the port type from the style attribute --> + <xsl:variable name="port"> + <xsl:choose> + <xsl:when test="contains(@style, ';')"> + <xsl:value-of select="substring-before(@style, ';')" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@style" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Get parent mxCell with port count --> + <xsl:for-each select="key('k-cell', @ParentComponent)"> + <!-- Get the number of ports for calculating position --> + <xsl:variable name="noofport"> + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="@controlPorts" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="@commandPorts" /> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:for-each select="mxGeometry"> + <xsl:choose> + <xsl:when test="($port = 'ExplicitInputPort' or $port = 'ImplicitInputPort') or ($port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort')"> + <xsl:value-of select="@y + @height * (2 * $ordering - 1) div (2 * $noofport)" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="@y" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="@y + @height" /> + </xsl:when> + </xsl:choose> </xsl:for-each> - - <!-- </xsl:when> - </xsl:choose> --> - </xsl:variable> - <xsl:attribute name="x"> - <xsl:choose> - <xsl:when test="$newx = ''"> - <xsl:value-of select="@x"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$newx"/> - </xsl:otherwise> - </xsl:choose> - </xsl:attribute> - <xsl:attribute name="y"> + </xsl:for-each> + </xsl:for-each> + </xsl:variable> + + <xsl:attribute name="y"> <xsl:choose> - <xsl:when test="$newy = ''"> - <xsl:value-of select="@y"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$newy"/> - </xsl:otherwise> - </xsl:choose> - </xsl:attribute> - <xsl:apply-templates select="node()" /> + <xsl:when test="$newy = ''"> + <xsl:value-of select="@y" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$newy" /> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <!-- }}} --> + <xsl:apply-templates select="node()" /> </xsl:copy> -</xsl:template> -<!-- mxcell tarx & tary & tar2x & tar2y --> -<xsl:template match="mxCell[@edge='1']"> + </xsl:template> + <!-- }}}3 --> + + <!-- mxcell tarx & tary & tar2x & tar2y {{{4 --> + <xsl:template match="mxCell[@edge='1']"> <xsl:copy> <xsl:apply-templates select="@*" /> + <xsl:variable name="newtarx"> - <!-- <xsl:choose> - <xsl:when test="(@tarx != '0.0' or @tary != '0.0')"> - <xsl:value-of select="@tarx"/> - </xsl:when> - <xsl:when test="(@tarx = '0.0' and @tary = '0.0')"> --> - <xsl:for-each select="key('k-cell', @sourceVertex)"> - <xsl:variable name="ordering"> - <xsl:value-of select="@ordering"/> - </xsl:variable> - - <xsl:variable name="port" select="substring-before(@style, ';')"/> - - <!-- Find the mxCell whose id matches sourceVertex --> - <xsl:for-each select="key('k-cell', @ParentComponent)"> - <xsl:variable name="noofport"> - <xsl:choose> - <xsl:when test="$port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort'"> - <xsl:value-of select="@implicitOutputPorts + @explicitOutputPorts" /> - </xsl:when> - <xsl:when test="$port = 'ImplicitInputPort' or $port = 'ExplicitInputPort'"> - <xsl:value-of select="@implicitInputPorts + @explicitInputPorts" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort'"> - <xsl:value-of select="@commandPorts" /> - </xsl:when> - <xsl:when test="$port = 'ControlPort'"> - <xsl:value-of select="@controlPorts" /> - </xsl:when> - </xsl:choose> - </xsl:variable> - - <xsl:for-each select="mxGeometry"> - - <xsl:choose> - <xsl:when test="$port = 'ImplicitInputPort' or $port = 'ExplicitInputPort'"> - <xsl:value-of select="@x" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort' or $port = 'ControlPort'"> - <xsl:value-of select="(@x + @width * (2 * $ordering -1) div (2 * $noofport))" /> - </xsl:when> - <xsl:when test="$port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort'"> - <xsl:value-of select="@x + @width" /> - </xsl:when> - - </xsl:choose> - </xsl:for-each> - - </xsl:for-each> - </xsl:for-each> - - <!-- </xsl:when> - </xsl:choose> --> - </xsl:variable> - <xsl:variable name="newtary"> - <!-- <xsl:choose> - <xsl:when test="(@tarx != '0.0' or @tary != '0.0')"> - <xsl:value-of select="@tary"/> - </xsl:when> - <xsl:when test="(@tarx = '0.0' and @tary = '0.0')"> --> - <!-- Check for mxCell with sourceVertex --> - <xsl:for-each select="key('k-cell', @sourceVertex)"> - <xsl:variable name="ordering"> - <xsl:value-of select="@ordering"/> - </xsl:variable> - - <xsl:variable name="port" select="substring-before(@style, ';')"/> - - <!-- Find the mxCell whose id matches sourceVertex --> - <xsl:for-each select="key('k-cell', @ParentComponent)"> - <xsl:variable name="noofport"> - <xsl:choose> - <xsl:when test="$port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort'"> - <xsl:value-of select="@implicitOutputPorts + @explicitOutputPorts" /> - </xsl:when> - <xsl:when test="$port = 'ImplicitInputPort' or $port = 'ExplicitInputPort'"> - <xsl:value-of select="@implicitInputPorts + @explicitInputPorts" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort'"> - <xsl:value-of select="@commandPorts" /> - </xsl:when> - <xsl:when test="$port = 'ControlPort'"> - <xsl:value-of select="@controlPorts" /> - </xsl:when> - </xsl:choose> - </xsl:variable> - - <xsl:for-each select="mxGeometry"> - <xsl:choose> - <xsl:when test="($port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort') or ($port = 'ImplicitInputPort' or $port = 'ExplicitInputPort')"> - <xsl:value-of select="(@y + @height * (2 * $ordering - 1) div (2 * $noofport))" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort'"> - <xsl:value-of select="@y + @height" /> - </xsl:when> - <xsl:when test="$port = 'ControlPort'"> - <xsl:value-of select="@y" /> - </xsl:when> - - </xsl:choose> - </xsl:for-each> - - </xsl:for-each> - </xsl:for-each> - - <!-- </xsl:when> - </xsl:choose> --> - </xsl:variable> - - -<!-- tar2x & tar2y --> - <xsl:variable name="newtar2x"> - <!-- <xsl:choose> - <xsl:when test="(@tar2x != '0.0' or @tar2y != '0.0')"> - <xsl:value-of select="@tar2x"/> - </xsl:when> - <xsl:when test="(@tar2x = '0.0' and @tar2y = '0.0')"> --> - <!-- Check for mxCell with sourceVertex --> - - <xsl:for-each select="key('k-cell', @targetVertex)"> - <xsl:variable name="ordering"> - <xsl:value-of select="@ordering"/> - </xsl:variable> - - <xsl:variable name="port" select="substring-before(@style, ';')"/> - - <!-- Find the mxCell whose id matches sourceVertex --> - <xsl:for-each select="key('k-cell', @ParentComponent)"> - <xsl:variable name="noofport"> - <xsl:choose> - <xsl:when test="$port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort'"> - <xsl:value-of select="@implicitOutputPorts + @explicitOutputPorts" /> - </xsl:when> - <xsl:when test="$port = 'ImplicitInputPort' or $port = 'ExplicitInputPort'"> - <xsl:value-of select="@implicitInputPorts + @explicitInputPorts" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort'"> - <xsl:value-of select="@commandPorts" /> - </xsl:when> - <xsl:when test="$port = 'ControlPort'"> - <xsl:value-of select="@controlPorts" /> - </xsl:when> - </xsl:choose> - </xsl:variable> - - <xsl:for-each select="mxGeometry"> - - <xsl:choose> - <xsl:when test="$port = 'ImplicitInputPort' or $port = 'ExplicitInputPort'"> - <xsl:value-of select="@x" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort' or $port = 'ControlPort'"> - <xsl:value-of select="(@x + @width * (2 * $ordering -1) div (2 * $noofport))" /> - </xsl:when> - <xsl:when test="$port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort'"> - <xsl:value-of select="@x + @width" /> - </xsl:when> - - </xsl:choose> - </xsl:for-each> - - </xsl:for-each> - </xsl:for-each> - - <!-- </xsl:when> - </xsl:choose> --> - </xsl:variable> - <xsl:variable name="newtar2y"> - <!-- <xsl:choose> - <xsl:when test="(@tar2x != '0.0' or @tar2y != '0.0')"> - <xsl:value-of select="@tar2y"/> - </xsl:when> - <xsl:when test="(@tar2x = '0.0' and @tar2y = '0.0')"> --> - <!-- Check for mxCell with targetVertex --> - <xsl:for-each select="key('k-cell', @targetVertex)"> - <xsl:variable name="ordering"> - <xsl:value-of select="@ordering"/> - </xsl:variable> - - <xsl:variable name="port" select="substring-before(@style, ';')"/> - - <!-- Find the mxCell whose id matches targetVertex --> - <xsl:for-each select="key('k-cell', @ParentComponent)"> - <xsl:variable name="noofport"> - <xsl:choose> - <xsl:when test="$port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort'"> - <xsl:value-of select="@implicitOutputPorts + @explicitOutputPorts" /> - </xsl:when> - <xsl:when test="$port = 'ImplicitInputPort' or $port = 'ExplicitInputPort'"> - <xsl:value-of select="@implicitInputPorts + @explicitInputPorts" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort'"> - <xsl:value-of select="@commandPorts" /> - </xsl:when> - <xsl:when test="$port = 'ControlPort'"> - <xsl:value-of select="@controlPorts" /> - </xsl:when> - </xsl:choose> - </xsl:variable> - - <xsl:for-each select="mxGeometry"> - <xsl:choose> - <xsl:when test="($port = 'ImplicitOutputPort' or $port = 'ExplicitOutputPort') or ($port = 'ImplicitInputPort' or $port = 'ExplicitInputPort')"> - <xsl:value-of select="(@y + @height * (2 * $ordering - 1) div (2 * $noofport))" /> - </xsl:when> - <xsl:when test="$port = 'CommandPort'"> - <xsl:value-of select="@y + @height" /> - </xsl:when> - <xsl:when test="$port = 'ControlPort'"> - <xsl:value-of select="@y" /> - </xsl:when> - - </xsl:choose> - </xsl:for-each> - - </xsl:for-each> + <!-- Get mxCell with sourceVertex --> + <xsl:for-each select="key('k-cell', @sourceVertex)"> + <!-- Get the port number for calculating position --> + <xsl:variable name="ordering"> + <xsl:value-of select="@ordering" /> + </xsl:variable> + + <!-- Get the port type from the style attribute --> + <xsl:variable name="port"> + <xsl:choose> + <xsl:when test="contains(@style, ';')"> + <xsl:value-of select="substring-before(@style, ';')" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@style" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Get parent mxCell with port count --> + <xsl:for-each select="key('k-cell', @ParentComponent)"> + <!-- Get the number of ports for calculating position --> + <xsl:variable name="noofport"> + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="@controlPorts" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="@commandPorts" /> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:for-each select="mxGeometry"> + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="@x" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="@x + @width" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort' or $port = 'CommandPort'"> + <xsl:value-of select="@x + @width * (2 * $ordering - 1) div (2 * $noofport)" /> + </xsl:when> + </xsl:choose> </xsl:for-each> - - <!-- </xsl:when> - </xsl:choose> --> - </xsl:variable> + </xsl:for-each> + </xsl:for-each> + </xsl:variable> - <xsl:attribute name="tarx"> - <xsl:choose> - <xsl:when test="$newtarx = ''"> - <xsl:value-of select="@tarx"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$newtarx"/> - </xsl:otherwise> - </xsl:choose> - <!-- <xsl:value-of select="$newtarx"/> --> - </xsl:attribute> - <xsl:attribute name="tary"> + <xsl:attribute name="tarx"> <xsl:choose> - <xsl:when test="$newtary = ''"> - <xsl:value-of select="@tary"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$newtary"/> - </xsl:otherwise> + <xsl:when test="$newtarx = ''"> + <xsl:value-of select="@tarx" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$newtarx" /> + </xsl:otherwise> </xsl:choose> - <!-- <xsl:value-of select="$newtary"/> --> - </xsl:attribute> - <xsl:attribute name="tar2x"> + </xsl:attribute> + + <xsl:variable name="newtary"> + <!-- Check for mxCell with sourceVertex --> + <xsl:for-each select="key('k-cell', @sourceVertex)"> + <xsl:variable name="ordering"> + <xsl:value-of select="@ordering" /> + </xsl:variable> + + <xsl:variable name="port"> + <xsl:choose> + <xsl:when test="contains(@style, ';')"> + <xsl:value-of select="substring-before(@style, ';')" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@style" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Find the mxCell whose id matches sourceVertex --> + <xsl:for-each select="key('k-cell', @ParentComponent)"> + <!-- Get the number of ports for calculating position --> + <xsl:variable name="noofport"> + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="@controlPorts" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="@commandPorts" /> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:for-each select="mxGeometry"> + <xsl:choose> + <xsl:when test="($port = 'ExplicitInputPort' or $port = 'ImplicitInputPort') or ($port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort')"> + <xsl:value-of select="@y + @height * (2 * $ordering - 1) div (2 * $noofport)" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="@y" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="@y + @height" /> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:for-each> + </xsl:for-each> + </xsl:variable> + + <xsl:attribute name="tary"> <xsl:choose> - <xsl:when test="$newtar2x = ''"> - <xsl:value-of select="@tar2x"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$newtar2x"/> - </xsl:otherwise> + <xsl:when test="$newtary = ''"> + <xsl:value-of select="@tary" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$newtary" /> + </xsl:otherwise> </xsl:choose> - <!-- <xsl:value-of select="$newtar2x"/> --> - </xsl:attribute> - <xsl:attribute name="tar2y"> + </xsl:attribute> + + <!-- tar2x & tar2y --> + <xsl:variable name="newtar2x"> + <!-- Check for mxCell with sourceVertex --> + <xsl:for-each select="key('k-cell', @targetVertex)"> + <xsl:variable name="ordering"> + <xsl:value-of select="@ordering" /> + </xsl:variable> + + <xsl:variable name="port"> + <xsl:choose> + <xsl:when test="contains(@style, ';')"> + <xsl:value-of select="substring-before(@style, ';')" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@style" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Find the mxCell whose id matches sourceVertex --> + <xsl:for-each select="key('k-cell', @ParentComponent)"> + <!-- Get the number of ports for calculating position --> + <xsl:variable name="noofport"> + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="@controlPorts" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="@commandPorts" /> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:for-each select="mxGeometry"> + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="@x" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="@x + @width" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort' or $port = 'CommandPort'"> + <xsl:value-of select="@x + @width * (2 * $ordering - 1) div (2 * $noofport)" /> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:for-each> + </xsl:for-each> + </xsl:variable> + + <xsl:attribute name="tar2x"> <xsl:choose> - <xsl:when test="$newtar2y = ''"> - <xsl:value-of select="@tar2y"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$newtar2y"/> - </xsl:otherwise> + <xsl:when test="$newtar2x = ''"> + <xsl:value-of select="@tar2x" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$newtar2x" /> + </xsl:otherwise> </xsl:choose> - <!-- <xsl:value-of select="$newtar2y"/> --> - </xsl:attribute> - <xsl:apply-templates select="node()" /> - + </xsl:attribute> - <!-- <xsl:attribute name="x"> - <xsl:choose> - <xsl:when test="$newx = ''"> - <xsl:value-of select="@x"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$newx"/> - </xsl:otherwise> - </xsl:choose> - </xsl:attribute> - <xsl:attribute name="y"> + <xsl:variable name="newtar2y"> + <!-- Check for mxCell with targetVertex --> + <xsl:for-each select="key('k-cell', @targetVertex)"> + <xsl:variable name="ordering"> + <xsl:value-of select="@ordering" /> + </xsl:variable> + + <xsl:variable name="port"> + <xsl:choose> + <xsl:when test="contains(@style, ';')"> + <xsl:value-of select="substring-before(@style, ';')" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@style" /> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Find the mxCell whose id matches targetVertex --> + <xsl:for-each select="key('k-cell', @ParentComponent)"> + <!-- Get the number of ports for calculating position --> + <xsl:variable name="noofport"> + <xsl:choose> + <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'"> + <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'"> + <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="@controlPorts" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="@commandPorts" /> + </xsl:when> + </xsl:choose> + </xsl:variable> + + <xsl:for-each select="mxGeometry"> + <xsl:choose> + <xsl:when test="($port = 'ExplicitInputPort' or $port = 'ImplicitInputPort') or ($port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort')"> + <xsl:value-of select="@y + @height * (2 * $ordering - 1) div (2 * $noofport)" /> + </xsl:when> + <xsl:when test="$port = 'ControlPort'"> + <xsl:value-of select="@y" /> + </xsl:when> + <xsl:when test="$port = 'CommandPort'"> + <xsl:value-of select="@y + @height" /> + </xsl:when> + </xsl:choose> + </xsl:for-each> + </xsl:for-each> + </xsl:for-each> + </xsl:variable> + + <xsl:attribute name="tar2y"> <xsl:choose> - <xsl:when test="$newy = ''"> - <xsl:value-of select="@y"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$newy"/> - </xsl:otherwise> - </xsl:choose> - </xsl:attribute> --> + <xsl:when test="$newtar2y = ''"> + <xsl:value-of select="@tar2y" /> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$newtar2y" /> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:apply-templates select="node()" /> </xsl:copy> -</xsl:template> + </xsl:template> + <!-- }}}4 --> + </xsl:stylesheet> diff --git a/blocks/eda-frontend/public/splitblock.xsl b/blocks/eda-frontend/public/splitblock.xsl index efb6586e..d6299c6a 100644 --- a/blocks/eda-frontend/public/splitblock.xsl +++ b/blocks/eda-frontend/public/splitblock.xsl @@ -126,7 +126,7 @@ <xsl:value-of select="$srconeotherblocky" /> </xsl:attribute> <xsl:attribute name="as">targetPoint</xsl:attribute> - </mxPoint> + </mxPoint> <Array as="points"> <xsl:for-each select="$tgtonelinkwaypoints"> <xsl:copy-of select="." /> |