<?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"?>
<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>
네임 스페이스를 가지고 내 orginal 한 XML에 위의 변환을 실행 한 후 나는 아래 얻을 -
<?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 파일을 강화하고자합니다.
는
<CustomerResponse>
<Address>
<state>PA</state>
<city>Harrisburg</city>
</Address>
<User>
<firstName>test</firstName>
<lastName>test</lastName>
</User>
</CustomerResponse>
귀하의 질문은 명확하지 않다. 원본 입력 XML과 예상되는 변환 결과를 보여주십시오. –
안녕 마이클, 예상 출력을 추가했습니다. –
원본 입력 사항도 함께 표시하십시오. - 원하는 출력이 올바른 형식의 XML이 아니라는 사실을 알고 있습니까? –