<?xml version="1.0" encoding="utf-8"?>
<typ:CustomerResponse xmlns:typ="http://xml.mycomp.com/customer/types">
<typ:CustomerReturn>
<typ:Address>
<typ:state>PA</typ:state>
<typ:city>Harrisburg</typ:city>
</typ:Address>
<typ:User>
<typ:firstName>test</typ:firstName>
<typ:lastName>test</typ:lastName>
</typ:User>
</typ:CustomerReturn>
</typ:CustomerResponse>
元の要求。
<?xml version="1.0" encoding="utf-8"?>
<CustomerResponse>
<CustomerReturn>
<Address>
<state>PA</state>
<city>Harrisburg</city>
</Address>
<User>
<firstName>test</firstName>
<lastName>test</lastName>
</User>
</CustomerReturn>
</CustomerResponse>
私は以下のような出力を得るために、既存のXSLTファイルを強化したい - 私は、以下の取得の名前空間を持っている私のorginalのxml上で上記の変換を実行した後
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output method="xml" indent="yes" />
<xsl:template match="*">
<xsl:element name="{local-name(.)}">
<xsl:apply-templates select="@* | node()" />
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{local-name(.)}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:template>
<xsl:template match="@xsi:nil[.='true']"/>
</xsl:stylesheet>
。
予想される出力
<CustomerResponse>
<Address>
<state>PA</state>
<city>Harrisburg</city>
</Address>
<User>
<firstName>test</firstName>
<lastName>test</lastName>
</User>
</CustomerResponse>
あなたの質問は明らかではありません。元の入力XMLと変換の予想される出力を表示してください。 –
こんにちは、マイケルは、予想される出力を追加しました。 –
オリジナルの入力も表示してください。 - あなたが望む出力が整形式のXMLではないことを知っていますか? –