1,332 → 1,521 |
<!-- back-direction for RegionEditor |
status: not tested |
status: problems with namespace and comments |
updated to given schema from 15/07/2003 |
Last Revision: 18/07/2003 by Sascha Walkenhorst --> |
Last Revision: 25/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" /> |
|
|
<xsl:template match="/"> |
<xsl:apply-templates /> |
<xsl:template match="node()"> |
<xsl:if test="not(name() = ('REGIONSET'))"> |
<xsl:if test="not(name() = ('IMAGE'))"> |
<xsl:element name="{name()}"> |
<xsl:for-each select="attribute::*"> |
<xsl:attribute name="{name()}"> |
<xsl:value-of select="." /> |
</xsl:attribute> |
</xsl:for-each> |
|
<xsl:for-each select="node()"> |
<xsl:apply-templates select="." /> |
</xsl:for-each> |
</xsl:element> |
</xsl:if></xsl:if> |
</xsl:template> |
|
<xsl:template match="text()"> |
<xsl:variable name="testWhetherEmpty"> |
<xsl:value-of select="." /> |
</xsl:variable> |
|
<xsl:template match="REGIONS"><!-- element-plugin association --> |
<xsl:element name="REGIONS"> |
<xsl:if test="normalize-space($testWhetherEmpty) != ''"> |
<xsl:value-of select="$testWhetherEmpty" /> |
</xsl:if> |
</xsl:template> |
|
<!-- 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:template match="REGIONSET"> |
<xsl:choose> |
<xsl:when test="@XMLEditorSavedNameOfNode = 'REGIONS'"> |
<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> |
</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" /> |
<!-- copy all other attributes --> |
<xsl:for-each select="attribute::*"> |
<xsl:if test="not(name(.) = 'image')"> |
<xsl:if test="not(name(.) = 'XMLEditorSavedNameOfNode')"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</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:if></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"> |
<!-- copy all attributes --> |
<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(.) = 'XMLEditorSavedNameOfNode')"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:if></xsl:if></xsl:if></xsl:if></xsl:if> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:for-each> |
|
<!-- 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 |
if its name was not COORDS which is the standard name. With |
this information can the original element reconstructed.--> |
<xsl:for-each select="COORDS"> |
<xsl:choose> |
<xsl:when test="@XMLEditorSavedNameOfNode = 'COORD_DATA'"> |
<xsl:element name="COORD_DATA"> |
<xsl:attribute name="x_pos"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
<xsl:attribute name="y_pos"> |
<xsl:value-of select="@y" /> |
</xsl:attribute> |
<xsl:attribute name="width"> |
<xsl:value-of select="@w" /> |
</xsl:attribute> |
<xsl:attribute name="height"> |
<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:if test="not(name(.) = 'XMLEditorSavedNameOfNode')"> |
<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:apply-templates select="." /> |
</xsl:for-each> |
</xsl:element> |
</xsl:when> |
<xsl:otherwise> |
<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: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:apply-templates select="." /> |
</xsl:for-each> |
</xsl:element> |
</xsl:otherwise> |
</xsl:choose> |
</xsl:for-each> |
|
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
<xsl:if test="not(name(.) = 'COORDS')"> |
<xsl:apply-templates select="." /> |
</xsl:if> |
</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> |
|
<!-- get information of used ellipse out of child 'ELLIPSE' --> |
<xsl:for-each select="ELLIPSE"> |
<xsl:element name="ELLIPSE"> |
<!-- copy all attributes --> |
<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 name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:for-each> |
|
<!-- get coordinates --> |
<xsl:for-each select="COORDS"> |
<xsl:element name="COORDS"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
</xsl:if></xsl:if></xsl:if></xsl:if></xsl:if> |
<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:apply-templates select="." /> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
<xsl:if test="not(name(.) = 'COORDS')"> |
<xsl:apply-templates select="." /> |
</xsl:if> |
</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> |
|
<!-- get information of used polyline out of child 'POLYLINE' --> |
<xsl:for-each select="POLYLINE"> |
<xsl:element name="POLYLINE"> |
<!-- copy all attributes --> |
<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 name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:for-each> |
|
<!-- get coordinates --> |
<xsl:for-each select="COORDS"> |
<xsl:element name="COORDS"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
</xsl:if></xsl:if> |
<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:apply-templates select="." /> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
<xsl:if test="not(name(.) = 'COORDS')"> |
<xsl:apply-templates select="." /> |
</xsl:if> |
</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:if test="not(name(.) = 'RECTANGLE')"> |
<xsl:if test="not(name(.) = 'ELLIPSE')"> |
<xsl:if test="not(name(.) = 'POLYLINE')"> |
<xsl:apply-templates select="." /> |
</xsl:if></xsl:if></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:when> |
|
<xsl:otherwise> |
<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> |
</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" /> |
<!-- copy all other attributes --> |
<xsl:for-each select="attribute::*"> |
<xsl:if test="not(name(.) = 'image')"> |
<xsl:if test="not(name(.) = 'XMLEditorSavedNameOfNode')"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</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:if></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"> |
<!-- copy all attributes --> |
<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(.) = 'XMLEditorSavedNameOfNode')"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:if></xsl:if></xsl:if></xsl:if></xsl:if> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:for-each> |
|
<!-- 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 |
if its name was not COORDS which is the standard name. With |
this information can the original element reconstructed.--> |
<xsl:for-each select="COORDS"> |
<xsl:choose> |
<xsl:when test="@XMLEditorSavedNameOfNode = 'COORD_DATA'"> |
<xsl:element name="COORD_DATA"> |
<xsl:attribute name="x_pos"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
<xsl:attribute name="y_pos"> |
<xsl:value-of select="@y" /> |
</xsl:attribute> |
<xsl:attribute name="width"> |
<xsl:value-of select="@w" /> |
</xsl:attribute> |
<xsl:attribute name="height"> |
<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:if test="not(name(.) = 'XMLEditorSavedNameOfNode')"> |
<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:apply-templates select="." /> |
</xsl:for-each> |
</xsl:element> |
</xsl:when> |
<xsl:otherwise> |
<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: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:apply-templates select="." /> |
</xsl:for-each> |
</xsl:element> |
</xsl:otherwise> |
</xsl:choose> |
</xsl:for-each> |
|
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
<xsl:if test="not(name(.) = 'COORDS')"> |
<xsl:apply-templates select="." /> |
</xsl:if> |
</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> |
|
<!-- get information of used ellipse out of child 'ELLIPSE' --> |
<xsl:for-each select="ELLIPSE"> |
<xsl:element name="ELLIPSE"> |
<!-- copy all attributes --> |
<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 name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:for-each> |
|
<!-- get coordinates --> |
<xsl:for-each select="COORDS"> |
<xsl:element name="COORDS"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
</xsl:if></xsl:if></xsl:if></xsl:if></xsl:if> |
<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:apply-templates select="." /> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
<xsl:if test="not(name(.) = 'COORDS')"> |
<xsl:apply-templates select="." /> |
</xsl:if> |
</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> |
|
<!-- get information of used polyline out of child 'POLYLINE' --> |
<xsl:for-each select="POLYLINE"> |
<xsl:element name="POLYLINE"> |
<!-- copy all attributes --> |
<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 name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:for-each> |
|
<!-- get coordinates --> |
<xsl:for-each select="COORDS"> |
<xsl:element name="COORDS"> |
<xsl:attribute name="x"> |
<xsl:value-of select="@x" /> |
</xsl:attribute> |
</xsl:if></xsl:if> |
<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:apply-templates select="." /> |
</xsl:for-each> |
</xsl:element> |
</xsl:for-each> |
<!-- copy all other childs --> |
<xsl:for-each select="node()"> |
<xsl:copy-of select="self::node()" /> |
<xsl:if test="not(name(.) = 'COORDS')"> |
<xsl:apply-templates select="." /> |
</xsl:if> |
</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:if test="not(name(.) = 'RECTANGLE')"> |
<xsl:if test="not(name(.) = 'ELLIPSE')"> |
<xsl:if test="not(name(.) = 'POLYLINE')"> |
<xsl:apply-templates select="." /> |
</xsl:if></xsl:if></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:otherwise> |
</xsl:choose> |
</xsl:template> |
|
</xsl:element> |
<xsl:template match="IMAGE"> |
<xsl:choose> |
<xsl:when test="@XMLEditorSavedNameOfNode = 'PHOTO'"> |
<xsl:element name="PHOTO"> |
<!-- work on attributes and childs --> |
<xsl:attribute name="label"> |
<xsl:value-of select="@name" /> |
</xsl:attribute> |
<xsl:attribute name="uri"> |
<xsl:value-of select="@url" /> |
</xsl:attribute> |
<xsl:for-each select="attribute::*"> |
<xsl:if test="not(name(.) = ('name'))"> |
<xsl:if test="not(name(.) = ('url'))"> |
<xsl:if test="not(name(.) = ('XMLEditorSavedNameOfNode'))"> |
<xsl:attribute name="{name(.)}"> |
<xsl:value-of select="self::node()" /> |
</xsl:attribute> |
</xsl:if></xsl:if></xsl:if> |
</xsl:for-each> |
<xsl:for-each select="node()"> |
<xsl:apply-templates select="." /> |
</xsl:for-each> |
</xsl:element> |
</xsl:when> |
|
<xsl:otherwise> |
<xsl:element name="IMAGE"> |
<!-- work on attributes and childs --> |
<xsl:attribute name="label"> |
<xsl:value-of select="@name" /> |
</xsl:attribute> |
<xsl:attribute name="uri"> |
<xsl:value-of select="@url" /> |
</xsl:attribute> |
<xsl:for-each select="attribute::*"> |
<xsl:if test="not(name(.) = ('name'))"> |
<xsl:if test="not(name(.) = ('url'))"> |
<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:apply-templates select="." /> |
</xsl:for-each> |
</xsl:element> |
</xsl:otherwise> |
</xsl:choose> |
</xsl:template> |
|
|