私の入力xmlは、json名前空間で次のようになります..
<json:object xmlns:json="http://www.ibm.com/xmlns/prod/2009/jsonx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<json:object name="Login">
<json:object name="Group">
<json:object name="TargetSystem">
<json:string name="Name">john</json:string>
<json:string name="Password"/>
</json:object>
</json:object>
</json:object>
</json:object>
このような出力が必要です
<Login>
<Group>
<TargetSystem>
<Name>john</Name>
<Password/>
</TargetSystem>
</Group>
</Login>
xslt を使用して入力 xml の属性名の値を使用して、この xml を作成する必要があります。以下のxsltを使用しています。
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:json="http://www.ibm.com/xmlns/prod/2009/jsonx">
<xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
<xsl:template match="/">
<xsl:apply-templates select="json:object/*"/>
</xsl:template>
<xsl:template match="json:object">
<xsl:element name="{@name}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
これを使用すると、ジョンだけが得られます。ループの概念を使用する必要があります..どうすればこれを達成できるか教えてください。