입력 XML에서 GetBasicData
요소에는 a_default namespace _ ( "CRS610MI")가 있습니다. 반면 CONO
및 CUNO
요소에는 네임 스페이스가 없습니다.
스타일 시트에 네임 스페이스 선언을 추가하십시오. 또한 출력 옵션을 indent="yes"
사용하면 출력을 사람이 더 쉽게 읽을 수 있습니다.
귀하의 의도는 soap:Body
내용을 변경하지 않고 입력 XML을 내부에 넣는 것 같습니다 . 이 경우 XSLT 스타일 시트의 모든 항목을 재정의 할 필요가 없습니다. 원본 XML에서 가능한 한 많이 복사하십시오.
스타일 시트
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:crs="CRS610MI" exclude-result-prefixes="crs">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<soap:Body>
<xsl:apply-templates select="node()|@*"/>
</soap:Body>
</soap:Envelope>
</xsl:template>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
산출
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<soap:Body>
<GetBasicData xmlns="CRS610MI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CONO xmlns="">1</CONO>
<CUNO xmlns="">123456</CUNO>
</GetBasicData>
</soap:Body>
</soap:Envelope>
출처
https://stackoverflow.com/questions/22079816