2011-11-09 4 views
2

SOAP 메시지 본문에서 XML 태그를 비롯한 모든 것을 가져 오는 방법을 알아 내려고합니다. 여기 SOAP 메시지 본문에서 XML을 가져 오는 XSLT

는 내가 지금까지 무엇을 가지고 :

<?xml version="1.0" encoding="utf-8"?> 
    <xsl:stylesheet version="1.0" 
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
     xmlns:soap="http://soap/envelope/" 
    > 
    <xsl:output method="xml" indent="no"/> 

    <xsl:template match="//soap:Body/*"> 
    </xsl:template> 
</xsl:stylesheet> 

답변

4

다음 스타일 시트 :

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
    xmlns:m="http://www.example.org/stock"> 
    <xsl:template match="/"> 
     <xsl:apply-templates select="soap:Envelope/soap:Body/*"/> 
    </xsl:template> 
    <xsl:template match="@*|node()"> 
     <xsl:copy> 
      <xsl:apply-templates select="@*|node()"/> 
     </xsl:copy> 
    </xsl:template> 
</xsl:stylesheet> 

위키 백과에서 this SOAP example에 적용 : SOAP 본문의

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> 
    <soap:Header></soap:Header> 
    <soap:Body> 
     <m:GetStockPrice xmlns:m="http://www.example.org/stock"> 
      <m:StockName>IBM</m:StockName> 
     </m:GetStockPrice> 
    </soap:Body> 
</soap:Envelope> 

출력 내용 (body 요소 자체는 포함하지 않음) :

<m:GetStockPrice xmlns:m="http://www.example.org/stock" 
       xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> 
    <m:StockName>IBM</m:StockName> 
</m:GetStockPrice> 
관련 문제