meine xml Datei
....
<loops>
<loop no="1" deltaxml:delta="WFmodify">
<Element1 deltaxml:delta="WFmodify"/>
<Element1 deltaxml:delta="unchanged"/>
</loop>
<loop no="2" deltaxml:delta="WFmodify">
<Element1 deltaxml:delta="WFmodify"/>
<Element2 deltaxml:delta="WFmodify"/>
</loop>
<loop deltaxml:delta="WFmodify"
old-attributs="no="3"" new-attributs="no="4"">
<Element1 deltaxml:delta="unchanged"/>
<Element2 deltaxml:delta="unchanged"/>
</loop>
<loop no="5" deltaxml:delta="unchanged" >
<Element1 deltaxml:delta="unchanged"/>
<Element2 deltaxml:delta="unchanged"/>
</loop>
</loops>
....
die gewünschte xml Datei nach xsl Transformation
....
<modified>
<loop no="1"/>
<loop no="2"/>
</modified>
<renamed>
< loop oldVariable="no="3""
newVariable="no="4"">
</renamed>
<unchanged>
<loop no="5">
</unchanged>
....
Die Bedingungen sind, falls die Attribut von loop gleich "deltaxml.delta='WFmodify'" ist, und die Attribut von ihren Elementn gleich "deltaxml.delta='unchanged'" ist, dann ist diese loop zu <renamed> gehören. Falls die Attribute von loop und ihren Elementen gleich "unchanged" sind, gehört sie zu <unchanged>, sonst ist <modified>,
Ich habe wie folgende xsl geschrieben.
<xsl:template match="loops" >
<xsl:copy>
<xsl:element name="modified">
<xsl:apply-templates select="......"/>
</xsl:element>
<xsl:element name="renamed">
<xsl:apply-templates select="......"/>
</xsl:element>
<xsl:element name="unchanged">
<xsl:apply-templates select="loop[@deltaxml:delta='unchanged']"/>
</xsl:copy>
</xsl:template>
<xsl:template match="loop">
<xsl:copy>
<xsl:apply-templates select="@no"/>
</xsl:copy>
</xsl.template>
......
Die Frage ist, wie ich Element <modified> und <renamed> in XSLT definieren?
....
<loops>
<loop no="1" deltaxml:delta="WFmodify">
<Element1 deltaxml:delta="WFmodify"/>
<Element1 deltaxml:delta="unchanged"/>
</loop>
<loop no="2" deltaxml:delta="WFmodify">
<Element1 deltaxml:delta="WFmodify"/>
<Element2 deltaxml:delta="WFmodify"/>
</loop>
<loop deltaxml:delta="WFmodify"
old-attributs="no="3"" new-attributs="no="4"">
<Element1 deltaxml:delta="unchanged"/>
<Element2 deltaxml:delta="unchanged"/>
</loop>
<loop no="5" deltaxml:delta="unchanged" >
<Element1 deltaxml:delta="unchanged"/>
<Element2 deltaxml:delta="unchanged"/>
</loop>
</loops>
....
die gewünschte xml Datei nach xsl Transformation
....
<modified>
<loop no="1"/>
<loop no="2"/>
</modified>
<renamed>
< loop oldVariable="no="3""
newVariable="no="4"">
</renamed>
<unchanged>
<loop no="5">
</unchanged>
....
Die Bedingungen sind, falls die Attribut von loop gleich "deltaxml.delta='WFmodify'" ist, und die Attribut von ihren Elementn gleich "deltaxml.delta='unchanged'" ist, dann ist diese loop zu <renamed> gehören. Falls die Attribute von loop und ihren Elementen gleich "unchanged" sind, gehört sie zu <unchanged>, sonst ist <modified>,
Ich habe wie folgende xsl geschrieben.
<xsl:template match="loops" >
<xsl:copy>
<xsl:element name="modified">
<xsl:apply-templates select="......"/>
</xsl:element>
<xsl:element name="renamed">
<xsl:apply-templates select="......"/>
</xsl:element>
<xsl:element name="unchanged">
<xsl:apply-templates select="loop[@deltaxml:delta='unchanged']"/>
</xsl:copy>
</xsl:template>
<xsl:template match="loop">
<xsl:copy>
<xsl:apply-templates select="@no"/>
</xsl:copy>
</xsl.template>
......
Die Frage ist, wie ich Element <modified> und <renamed> in XSLT definieren?
Comment