3

以下のことができる XSLT を探しています。

XML メッセージをクイック ソープ エンベロープ (xml) でラップしようとしています。ソース XML は固定されていないため、XSLT は XML が何であるかを気にする必要はありません。XML の先頭から XML 宣言を削除する必要があります。

例:

<?xml version="1.0"?>
<foo>
    <bar />
</foo>

に変換:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:hl7-org:v3">
    <soapenv:Header/>
    <soapenv:Body>
          <foo>
            <bar />
          </foo>
    </soapenv:Body>
</soapenv:Envelope>  

例 2:

<lady>
  <and>
   <the>
    <tramp />
   </the>
  </and>
</lady>



<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:hl7-org:v3">
    <soapenv:Header/>
    <soapenv:Body>
         <lady>
           <and>
              <the>
                  <tramp />
             </the>
           </and>
         </lady>
    </soapenv:Body>
</soapenv:Envelope>  
4

2 に答える 2

2

これを使用できます(これはPhoenixblade9の回答に似ていますが、使用しませんxsl:element

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template match="/">
        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:hl7-org:v3">
            <soapenv:Header/>
            <soapenv:Body>
                <xsl:copy-of select="*"/>
            </soapenv:Body>
        </soapenv:Envelope>
    </xsl:template>

</xsl:stylesheet>
于 2013-04-16T23:41:09.607 に答える