summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuchita Lad2024-07-08 16:03:34 +0530
committerSuchita Lad2024-08-27 13:01:05 +0530
commit750c5399383a871b6847bd53188b67049ae906a2 (patch)
tree9c607a7069179677fdde813496e18aee12bfab0c
parentba9a1d23b65278e13be7fa7ceb1966591febaccc (diff)
downloadCommon-Interface-Project-750c5399383a871b6847bd53188b67049ae906a2.tar.gz
Common-Interface-Project-750c5399383a871b6847bd53188b67049ae906a2.tar.bz2
Common-Interface-Project-750c5399383a871b6847bd53188b67049ae906a2.zip
Added split.xsl file
-rw-r--r--blocks/Makefile1
-rw-r--r--blocks/eda-frontend/public/split.xsl179
-rw-r--r--blocks/xcos2xml/split.xsl84
3 files changed, 85 insertions, 179 deletions
diff --git a/blocks/Makefile b/blocks/Makefile
index 648ac1bb..a8751c4c 100644
--- a/blocks/Makefile
+++ b/blocks/Makefile
@@ -8,6 +8,7 @@ SRCFILES += $(sort $(wildcard Xcos/ports/*.py))
SRCFILES += $(sort $(wildcard Xcos/links/*.py))
XCOS2XMLFILES := $(sort $(wildcard xcos2xml/head.xsl))
+XCOS2XMLFILES += $(sort $(wildcard xcos2xml/split.xsl))
XCOS2XMLFILES += $(sort $(wildcard xcos2xml/blocks/*.xsl))
XCOS2XMLFILES += $(sort $(wildcard xcos2xml/ports/*.xsl))
XCOS2XMLFILES += $(sort $(wildcard xcos2xml/links/*.xsl))
diff --git a/blocks/eda-frontend/public/split.xsl b/blocks/eda-frontend/public/split.xsl
deleted file mode 100644
index 370c84fc..00000000
--- a/blocks/eda-frontend/public/split.xsl
+++ /dev/null
@@ -1,179 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:ext="http://exslt.org/common"
- xmlns:fCondInInterval="f:fCondInInterval"
- xmlns:fScaleByE="f:fScaleByE"
- xmlns:x="f:x-exp.xsl"
- exclude-result-prefixes="xsl ext fCondInInterval fScaleByE x"
->
-<xsl:key name="k-input" match="ExplicitInputPort" use="@parent" />
-<xsl:key name="k-output" match="ExplicitOutputPort" use="@parent" />
-<xsl:key name="k-srclink" match="ExplicitLink" use="@source" />
-<xsl:key name="k-tgtlink" match="ExplicitLink" use="@target" />
-<xsl:key name="k-exin" match="ExplicitInputPort" use="@id" />
-<xsl:key name="k-exout" match="ExplicitOutputPort" use="@id" />
-<xsl:key name="k-split" match="SplitBlock" use="@id" />
-
- <xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="comment()"/>
- <xsl:template match="XcosDiagram">
- <xsl:apply-templates select="node()"/>
- </xsl:template>
- <xsl:template match="mxGraphModel">
- <xsl:copy>
- <xsl:apply-templates select="@*[name(.)!='as']"/>
- <xsl:apply-templates select="node()"/>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="mxCell[position()=1]">
- <xsl:copy>
- <xsl:attribute name="id">
- <xsl:value-of select="@id" />
- </xsl:attribute>
- <xsl:attribute name="appname">Xcos</xsl:attribute>
- <xsl:attribute name="description"></xsl:attribute>
- <xsl:attribute name="CellType">Unknown</xsl:attribute>
- <xsl:attribute name="sourceVertex">0</xsl:attribute>
- <xsl:attribute name="targetVertex">0</xsl:attribute>
- <xsl:attribute name="tarx">0</xsl:attribute>
- <xsl:attribute name="tary">0</xsl:attribute>
- <Object as="parameter_values"/>
- <Object as="displayProperties"/>
- <xsl:apply-templates select="node()"/>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="mxCell[position()=2]">
- <xsl:copy>
- <xsl:attribute name="id">
- <xsl:value-of select="@id" />
- </xsl:attribute>
- <xsl:attribute name="CellType">Unknown</xsl:attribute>
- <xsl:attribute name="sourceVertex">0</xsl:attribute>
- <xsl:attribute name="targetVertex">0</xsl:attribute>
- <xsl:attribute name="tarx">0</xsl:attribute>
- <xsl:attribute name="tary">0</xsl:attribute>
- <Object as="parameter_values"/>
- <Object as="displayProperties"/>
- <xsl:apply-templates select="node()"/>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="SplitBlock">
- <xsl:for-each select="key('k-input', @id)">
- <xsl:for-each select="key('k-tgtlink', @id)">
- <xsl:for-each select="key('k-exout', @source)">
- <newlink id="{generate-id()}">
- <xsl:attribute name="linkid">
- <xsl:value-of select="@id"/>
- </xsl:attribute>
- </newlink>
- </xsl:for-each>
- </xsl:for-each>
- </xsl:for-each>
-
- <xsl:for-each select="key('k-output', @id)">
- <xsl:for-each select="key('k-srclink', @id)">
- <xsl:for-each select="key('k-exin', @target)">
- <newlink id="{generate-id()}">
- <xsl:attribute name="linkid1">
- <xsl:value-of select="@id"/>
- </xsl:attribute>
- </newlink>
- </xsl:for-each>
- </xsl:for-each>
- </xsl:for-each>
-
- </xsl:template>
-
- <xsl:template match="ExplicitLink">
- <xsl:variable name="sourceId" select="@source"/>
- <xsl:variable name="sourceElement" select="//*[@id = $sourceId]"/>
- <xsl:variable name="sourceElemId" select="$sourceElement[@parent]"/>
- <xsl:variable name="parentElement" select="//*[@id = sourceElemId]"/>
- <xsl:choose>
- <xsl:when test="name($parentElement) != 'SplitBlock'" >
-
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:attribute name="test4">
- <xsl:value-of select="name($sourceElement)" />
- </xsl:attribute>
- <xsl:attribute name="test5">
- <xsl:value-of select="$sourceId" />
- </xsl:attribute>
- <xsl:attribute name="test6">
- <xsl:value-of select="name($parentElement)" />
- </xsl:attribute>
- <xsl:attribute name="test7">
- <xsl:value-of select="sourceElemId" />
- </xsl:attribute>
- </xsl:copy>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="ExplicitInputPort">
- <xsl:variable name="parentId" select="@parent"/>
- <xsl:variable name="parentElement" select="//*[@id = $parentId]"/>
- <xsl:choose>
- <xsl:when test="name($parentElement) != 'SplitBlock'" >
-
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <!-- <xsl:attribute name="test">
- <xsl:value-of select="name($parentElement)" />
- </xsl:attribute>
- <xsl:attribute name="test1">
- <xsl:value-of select="$parentId" />
- </xsl:attribute> -->
- </xsl:copy>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="ExplicitOutputPort">
- <xsl:variable name="parentId" select="@parent"/>
- <xsl:variable name="parentElement" select="//*[@id = $parentId]"/>
- <xsl:choose>
- <xsl:when test="name($parentElement) != 'SplitBlock'" >
-
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <!-- <xsl:attribute name="test2">
- <xsl:value-of select="name($parentElement)" />
- </xsl:attribute>
- <xsl:attribute name="test3">
- <xsl:value-of select="$parentId" />
- </xsl:attribute> -->
- </xsl:copy>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
-
- <!-- select="key('k-split', @parent)"/> -->
-
-
-
- <xsl:template match="*">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="@*">
- <xsl:copy/>
- </xsl:template>
-
- <!-- <xsl:template match="SplitBlock"/> -->
-<!-- <xsl:template match="ExplicitLink[
- (@source = //newlink[@linkid = current()/@id]/@id)]"/>
- <xsl:template match="ExplicitInputPort[@parent=current()/@id]"/> -->
- <!-- <xsl:template match="ExplicitOutputPort[@parent='14']"/> -->
- <!-- <xsl:template match="ExplicitLink[@parent='1' and (@source='7' or @source='16' or @source='17')]"/> -->
-</xsl:stylesheet>
diff --git a/blocks/xcos2xml/split.xsl b/blocks/xcos2xml/split.xsl
new file mode 100644
index 00000000..39a14a5b
--- /dev/null
+++ b/blocks/xcos2xml/split.xsl
@@ -0,0 +1,84 @@
+<xsl:key name="k-input" match="ExplicitInputPort" use="@parent" />
+<xsl:key name="k-output" match="ExplicitOutputPort" use="@parent" />
+<xsl:key name="k-srclink" match="ExplicitLink" use="@source" />
+<xsl:key name="k-tgtlink" match="ExplicitLink" use="@target" />
+<xsl:key name="k-exin" match="ExplicitInputPort" use="@id" />
+<xsl:key name="k-exout" match="ExplicitOutputPort" use="@id" />
+<xsl:key name="k-split" match="SplitBlock" use="@id" />
+
+ <xsl:template match="SplitBlock">
+ <xsl:for-each select="key('k-input', @id)">
+ <xsl:for-each select="key('k-tgtlink', @id)">
+ <xsl:for-each select="key('k-exout', @source)">
+ <newlink id="{generate-id()}">
+ <xsl:attribute name="linkid">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ </newlink>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:for-each>
+
+ <xsl:for-each select="key('k-output', @id)">
+ <xsl:for-each select="key('k-srclink', @id)">
+ <xsl:for-each select="key('k-exin', @target)">
+ <newlink id="{generate-id()}">
+ <xsl:attribute name="linkid1">
+ <xsl:value-of select="@id"/>
+ </xsl:attribute>
+ </newlink>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:for-each>
+
+ </xsl:template>
+
+ <xsl:template match="ExplicitLink">
+ <xsl:variable name="sourceId" select="@source"/>
+ <xsl:variable name="sourceElement" select="//*[@id = $sourceId]"/>
+ <xsl:variable name="sourceElemId" select="$sourceElement/@parent"/>
+ <xsl:variable name="parentElement" select="//*[@id = $sourceElemId]"/>
+ <xsl:variable name="targetId" select="@target"/>
+ <xsl:variable name="targetElement" select="//*[@id = $targetId]"/>
+ <xsl:variable name="targetElemId" select="$targetElement/@parent"/>
+ <xsl:variable name="parentTargetElement" select="//*[@id = $targetElemId]"/>
+ <xsl:choose>
+ <xsl:when test="name($parentElement) != 'SplitBlock' and name($parentTargetElement) != 'SplitBlock'" >
+
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ <!-- <xsl:attribute name="test4">
+ <xsl:value-of select="$sourceId" />
+ </xsl:attribute>
+ <xsl:attribute name="test5">
+ <xsl:value-of select="name($sourceElement)" />
+ </xsl:attribute> -->
+ </xsl:copy>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="ExplicitInputPort | ExplicitOutputPort">
+ <xsl:variable name="parentId" select="@parent"/>
+ <xsl:variable name="parentElement" select="//*[@id = $parentId]"/>
+ <xsl:choose>
+ <xsl:when test="name($parentElement) != 'SplitBlock'" >
+
+ <xsl:copy>
+ <xsl:copy-of select="@*"/>
+ </xsl:copy>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- select="key('k-split', @parent)"/> -->
+
+ <!-- <xsl:template match="*">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="@*">
+ <xsl:copy/>
+ </xsl:template> -->