Ana içeriğe atla

Örnek Giriş Değeri

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
  <soapenv:Header/>
  <soapenv:Body>
    <tem:sendSingleSMS>
      <tem:numbers>05551112233</tem:numbers>
      <tem:message>Test</tem:message>
      <tem:sd>0</tem:sd>
      <tem:ed>0</tem:ed>
    </tem:sendSingleSMS>
  </soapenv:Body>
</soapenv:Envelope>

XSLT Dönüşüm Kodu

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output encoding="UTF-8" indent="yes" method="xml" version="1.0" />
  <xsl:strip-space elements="*" />
  <!-- copies all elements from source xml-->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
  </xsl:template>
  <!-- deletes matched elements from source xml-->
  <xsl:template match="username">
    <xsl:apply-templates />
  </xsl:template>
  <!-- deletes matched elements from source xml-->
  <xsl:template match="/soapenv:Envelope">
    <xsl:copy>
      <!-- copies elements inside this definition to matched element's content -->
      <soapenv:Body>
        <tem:sendSingleSMS>
          <tem:username>aaa</tem:username>
          <tem:password>123</tem:password>
          <tem:origin>localhost</tem:origin>
          <xsl:copy-of select="//*[local-name() = 'numbers']" />
          <xsl:copy-of select="//*[local-name() = 'message']" />
          <xsl:copy-of select="//*[local-name() = 'startDate']" />
          <xsl:copy-of select="//*[local-name() = 'endDate']" />
        </tem:sendSingleSMS>
      </soapenv:Body>
      <xsl:apply-templates />
    </xsl:copy>
  </xsl:template>
  <xsl:template match="soapenv:Body" />
</xsl:stylesheet>