10,9 → 10,322 |
<xsl:apply-templates /> |
</xsl:template> |
|
<xsl:template match="node()"> |
<xsl:copy-of select="." /> |
|
<xsl:template match="REGIONS"><!-- element-plugin association --> |
<xsl:element name="REGIONS"> |
|
<!-- work on attributes --> |
<!-- get information of used image out of attribute 'image' --> |
<xsl:attribute name="image"> |
<xsl:value-of select="@image" /> |
</xsl:attribute> |
<!-- copy all other attributes --> |
<xsl:for-each select="attribute::*"> |
<xsl:if test = "not(name(.) = ('image'))"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:if> |
</xsl:for-each> |
|
<!-- work on childs --> |
<!-- get information of used rectangle out of child 'RECTANGLE' --> |
<xsl:for-each select="RECTANGLE"> |
<xsl:element name="RECTANGLE"> |
<!-- get coordinates --> |
<!-- during transformation in to-direction an attribute named |
"XMLEditorSavedNameOfNode" should have been created which |
contains the name of the element the original element had. |
With this information can the original element reconstructed.--> |
<xsl:for-each select="COORDS"> |
<xsl:variable name="temp" select="@XMLEditorSavedNameOfNode" /> |
<xsl:element name="$temp"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
<xsl:attribute name="y"> |
<xsl:value-of select="@y" /> |
</xsl:attribute> |
<xsl:attribute name="w"> |
<xsl:value-of select="@w" /> |
</xsl:attribute> |
<xsl:attribute name="h"> |
<xsl:value-of select="@h" /> |
</xsl:attribute> |
<xsl:for-each select="attribute::*"> |
<xsl:if test = "not(name(.) = 'x')"> |
<xsl:if test = "not(name(.) = 'y')"> |
<xsl:if test = "not(name(.) = 'w')"> |
<xsl:if test = "not(name(.) = 'h')"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:if></xsl:if></xsl:if></xsl:if> |
</xsl:for-each> |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
|
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:if test = "not(name(.) = 'COORDS')"> |
<xsl:copy-of select="self::node()" /> |
</xsl:if> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
|
<!-- get information of used ellipse out of child 'ELLIPSE' --> |
<xsl:for-each select="ELLIPSE"> |
<xsl:element name="ELLIPSE"> |
<!-- get coordinates --> |
<xsl:for-each select="COORDS"> |
<xsl:element name="COORDS"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
<xsl:attribute name="y"> |
<xsl:value-of select="@y" /> |
</xsl:attribute> |
<xsl:attribute name="w"> |
<xsl:value-of select="@w" /> |
</xsl:attribute> |
<xsl:attribute name="h"> |
<xsl:value-of select="@h" /> |
</xsl:attribute> |
<xsl:attribute name="angle"> |
<xsl:value-of select="@angle" /> |
</xsl:attribute> |
<xsl:for-each select="attribute::*"> |
<xsl:if test = "not(name(.) = 'x')"> |
<xsl:if test = "not(name(.) = 'y')"> |
<xsl:if test = "not(name(.) = 'w')"> |
<xsl:if test = "not(name(.) = 'h')"> |
<xsl:if test = "not(name(.) = 'angle')"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:if></xsl:if></xsl:if></xsl:if></xsl:if> |
</xsl:for-each> |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:if test = "not(name(.) = 'COORDS')"> |
<xsl:copy-of select="self::node()" /> |
</xsl:if> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
|
<!-- get information of used polyline out of child 'POLYLINE' --> |
<xsl:for-each select="POLYLINE"> |
<xsl:element name="POLYLINE"> |
<!-- get coordinates --> |
<xsl:for-each select="COORDS"> |
<xsl:element name="COORDS"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
<xsl:attribute name="y"> |
<xsl:value-of select="@y" /> |
</xsl:attribute> |
<xsl:for-each select="attribute::*"> |
<xsl:if test = "not(name(.) = 'x')"> |
<xsl:if test = "not(name(.) = 'y')"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:if></xsl:if> |
</xsl:for-each> |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:if test = "not(name(.) = 'COORDS')"> |
<xsl:copy-of select="self::node()" /> |
</xsl:if> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
|
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:if test = "not(name(.) = 'RECTANGLE')"> |
<xsl:if test = "not(name(.) = 'ELLIPSE')"> |
<xsl:if test = "not(name(.) = 'POLYLINE')"> |
<xsl:copy-of select="self::node()" /> |
</xsl:if></xsl:if></xsl:if> |
</xsl:for-each> |
|
</xsl:element> |
</xsl:template> |
|
<xsl:template match="REGIONSET"><!-- element-plugin association --> |
<xsl:element name="REGIONSET"> |
|
<!-- work on attributes --> |
<!-- get information of used image out of attribute 'image' --> |
<xsl:attribute name="image"> |
<xsl:value-of select="@image" /> |
</xsl:attribute> |
<!-- copy all other attributes --> |
<xsl:for-each select="attribute::*"> |
<xsl:if test = "not(name(.) = ('image'))"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:if> |
</xsl:for-each> |
|
<!-- work on childs --> |
<!-- get information of used rectangle out of child 'RECTANGLE' --> |
<xsl:for-each select="RECTANGLE"> |
<xsl:element name="RECTANGLE"> |
<!-- get coordinates --> |
<!-- during transformation in to-direction an attribute named |
"XMLEditorSavedNameOfNode" should have been created which |
contains the name of the element the original element had. |
With this information can the original element reconstructed.--> |
<xsl:for-each select="COORDS"> |
<xsl:variable name="temp" select="@XMLEditorSavedNameOfNode" /> |
<xsl:element name="$temp"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
<xsl:attribute name="y"> |
<xsl:value-of select="@y" /> |
</xsl:attribute> |
<xsl:attribute name="w"> |
<xsl:value-of select="@w" /> |
</xsl:attribute> |
<xsl:attribute name="h"> |
<xsl:value-of select="@h" /> |
</xsl:attribute> |
<xsl:for-each select="attribute::*"> |
<xsl:if test = "not(name(.) = 'x')"> |
<xsl:if test = "not(name(.) = 'y')"> |
<xsl:if test = "not(name(.) = 'w')"> |
<xsl:if test = "not(name(.) = 'h')"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:if></xsl:if></xsl:if></xsl:if> |
</xsl:for-each> |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
|
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:if test = "not(name(.) = 'COORDS')"> |
<xsl:copy-of select="self::node()" /> |
</xsl:if> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
|
<!-- get information of used ellipse out of child 'ELLIPSE' --> |
<xsl:for-each select="ELLIPSE"> |
<xsl:element name="ELLIPSE"> |
<!-- get coordinates --> |
<xsl:for-each select="COORDS"> |
<xsl:element name="COORDS"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
<xsl:attribute name="y"> |
<xsl:value-of select="@y" /> |
</xsl:attribute> |
<xsl:attribute name="w"> |
<xsl:value-of select="@w" /> |
</xsl:attribute> |
<xsl:attribute name="h"> |
<xsl:value-of select="@h" /> |
</xsl:attribute> |
<xsl:attribute name="angle"> |
<xsl:value-of select="@angle" /> |
</xsl:attribute> |
<xsl:for-each select="attribute::*"> |
<xsl:if test = "not(name(.) = 'x')"> |
<xsl:if test = "not(name(.) = 'y')"> |
<xsl:if test = "not(name(.) = 'w')"> |
<xsl:if test = "not(name(.) = 'h')"> |
<xsl:if test = "not(name(.) = 'angle')"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:if></xsl:if></xsl:if></xsl:if></xsl:if> |
</xsl:for-each> |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:if test = "not(name(.) = 'COORDS')"> |
<xsl:copy-of select="self::node()" /> |
</xsl:if> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
|
<!-- get information of used polyline out of child 'POLYLINE' --> |
<xsl:for-each select="POLYLINE"> |
<xsl:element name="POLYLINE"> |
<!-- get coordinates --> |
<xsl:for-each select="COORDS"> |
<xsl:element name="COORDS"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
<xsl:attribute name="y"> |
<xsl:value-of select="@y" /> |
</xsl:attribute> |
<xsl:for-each select="attribute::*"> |
<xsl:if test = "not(name(.) = 'x')"> |
<xsl:if test = "not(name(.) = 'y')"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:if></xsl:if> |
</xsl:for-each> |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:if test = "not(name(.) = 'COORDS')"> |
<xsl:copy-of select="self::node()" /> |
</xsl:if> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
|
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:if test = "not(name(.) = 'RECTANGLE')"> |
<xsl:if test = "not(name(.) = 'ELLIPSE')"> |
<xsl:if test = "not(name(.) = 'POLYLINE')"> |
<xsl:copy-of select="self::node()" /> |
</xsl:if></xsl:if></xsl:if> |
</xsl:for-each> |
|
</xsl:element> |
</xsl:template> |
|
|
</xsl:stylesheet> |