0
xmlファイルは2つあります。両方が(下のノードの多くを有する)xsltを使用してxml配列を別の種類のxml配列に変換します。
人
のアレイであるIは、XSLTを使用して
<queryCompoundEmployeeResponse>
<CompoundEmployee>
<id></id>
<person>
<lot of nodes/>
</person>
</CompoundEmployee>
<CompoundEmployee>
<id></id>
<person>
<lot of nodes/>
</person>
</CompoundEmployee>
</queryCompoundEmployeeResponse>
にこれ
<result>
<sfobject>
<id></id>
<type>CompoundEmployee</type>
<person>
<lot of nodes/>
</person>
</sfobject>
<sfobject>
<id></id>
<type>CompoundEmployee</type>
<person>
<lot of nodes/>
</person>
</sfobject>
</result>
を変換する必要があります。私はそれのためにこのxsltを持っています。
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<xsl:strip-space elements="*" />
<xsl:template match="node()|@*" name="identity">
<xsl:copy>
<xsl:apply-templates select="node()|@*" />
</xsl:copy>
</xsl:template>
<xsl:template match="sfobject/*[1]">
<queryCompoundEmployeeResponse>
<CompoundEmployee>
<id>
<xsl:value-of select="@id" />
</id>
<xsl:copy-of select="/*/person[1]" />
<xsl:call-template name="identity" />
</id>
</CompoundEmployee>
</queryCompoundEmployeeResponse>
</xsl:template>
<xsl:template match="/*/sfobject[1]" />
<xsl:param name="removeElementsNamed" select="'type'"/>
</xsl:stylesheet>
これはよくチェックアウトしません。私はこれまでgroovyでこれをやったことがあるが、今はシステムが変更されたときにこれをxsltに変換しなければならない。私はxsltには新しく、ここでは高度なレベルのxsltを使用すると確信しています。どのポインタも高く評価されています。
ここではxsltは適切なツールですか?または私はグルーヴィーに固執する必要がありますか?