1,7 → 1,7 |
<!-- back-direction for RegionEditor |
status: not tested |
updated to given schema from 15/07/2003 |
Last Revision: 17/07/2003 by Sascha Walkenhorst --> |
Last Revision: 18/07/2003 by Sascha Walkenhorst --> |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
<xsl:output method="xml" indent="yes" /> |
|
33,8 → 33,13 |
<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:element name="COORDS"> |
<xsl:variable name="temp" select="@XMLEditorSavedNameOfNode" /> |
<xsl:element name="$temp"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
60,57 → 65,14 |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
</xsl:for-each> |
<!-- Insert an attribut which saves the original name of node, |
cause all nodes which contain data are transformed to a |
"COORDS" node. This extra information is used in back- |
transformation to restore the original name. --> |
<xsl:attribute name="XMLEditorSavedNameOfNode"> |
<xsl:value-of select="name(.)" /> |
</xsl:attribute> |
</xsl:element> |
</xsl:for-each> |
<xsl:for-each select="COORD_DATA"> |
<xsl:element name="COORDS"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x_pos" /> |
</xsl:attribute> |
<xsl:attribute name="y"> |
<xsl:value-of select="@y_pos" /> |
</xsl:attribute> |
<xsl:attribute name="w"> |
<xsl:value-of select="@width" /> |
</xsl:attribute> |
<xsl:attribute name="h"> |
<xsl:value-of select="@height" /> |
</xsl:attribute> |
<xsl:for-each select="attribute::*"> |
<xsl:if test = "not(name(.) = 'x_pos')"> |
<xsl:if test = "not(name(.) = 'y_pos')"> |
<xsl:if test = "not(name(.) = 'width')"> |
<xsl:if test = "not(name(.) = 'height')"> |
<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> |
<!-- Insert an attribut which saves the original name of node, |
cause all nodes which contain data are transformed to a |
"COORDS" node. This extra information is used in back- |
transformation to restore the original name. --> |
<xsl:attribute name="XMLEditorSavedNameOfNode"> |
<xsl:value-of select="name(.)" /> |
</xsl:attribute> |
</xsl:element> |
</xsl:for-each> |
|
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:if test = "not(name(.) = 'COORDS')"> |
<xsl:if test = "not(name(.) = 'COORD_DATA')"> |
<xsl:copy-of select="self::node()" /> |
</xsl:if></xsl:if> |
</xsl:if> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
229,8 → 191,13 |
<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:element name="COORDS"> |
<xsl:variable name="temp" select="@XMLEditorSavedNameOfNode" /> |
<xsl:element name="$temp"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
256,57 → 223,14 |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
</xsl:for-each> |
<!-- Insert an attribut which saves the original name of node, |
cause all nodes which contain data are transformed to a |
"COORDS" node. This extra information is used in back- |
transformation to restore the original name. --> |
<xsl:attribute name="XMLEditorSavedNameOfNode"> |
<xsl:value-of select="name(.)" /> |
</xsl:attribute> |
</xsl:element> |
</xsl:for-each> |
<xsl:for-each select="COORD_DATA"> |
<xsl:element name="COORDS"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x_pos" /> |
</xsl:attribute> |
<xsl:attribute name="y"> |
<xsl:value-of select="@y_pos" /> |
</xsl:attribute> |
<xsl:attribute name="w"> |
<xsl:value-of select="@width" /> |
</xsl:attribute> |
<xsl:attribute name="h"> |
<xsl:value-of select="@height" /> |
</xsl:attribute> |
<xsl:for-each select="attribute::*"> |
<xsl:if test = "not(name(.) = 'x_pos')"> |
<xsl:if test = "not(name(.) = 'y_pos')"> |
<xsl:if test = "not(name(.) = 'width')"> |
<xsl:if test = "not(name(.) = 'height')"> |
<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> |
<!-- Insert an attribut which saves the original name of node, |
cause all nodes which contain data are transformed to a |
"COORDS" node. This extra information is used in back- |
transformation to restore the original name. --> |
<xsl:attribute name="XMLEditorSavedNameOfNode"> |
<xsl:value-of select="name(.)" /> |
</xsl:attribute> |
</xsl:element> |
</xsl:for-each> |
|
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:if test = "not(name(.) = 'COORDS')"> |
<xsl:if test = "not(name(.) = 'COORD_DATA')"> |
<xsl:copy-of select="self::node()" /> |
</xsl:if></xsl:if> |
</xsl:if> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |