Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 617 → Rev 618

/sun/xmleditor/trunk/src/plugins/regionEditorPlugin/RegionEditorPluginTransform.xsl
10,398 → 10,9
<xsl:apply-templates />
</xsl:template>
 
 
<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 -->
<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: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>
<!-- Insert an attribute 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 attribute 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: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 match="node()">
<xsl:copy-of select="." />
</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 -->
<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: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>
<!-- Insert an attribute 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 attribute 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: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>