使用XSLT

时间:2016-09-20 17:29:48

标签: xslt

我有一个传入的SOAP消息,其中没有SOAP头标记,我需要在其中添加SOAP头。我正在使用此XSLT执行此操作,但SOAP HEADER未添加。 XSLT:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:dp="http://www.datapower.com/extensions" 
 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 extension-element-prefixes="dp" 
 exclude-result-prefixes="dp"  >
  <xsl:variable name="uuid" select="dp:variable('var://context/txn/uuid')" />
 <xsl:template match="node()|@*">
     <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
 </xsl:template> 
<xsl:template match="soapenv:Header">
    <soapenv:Header> 
        <UUID><xsl:value-of select="$uuid"/></UUID>
    </soapenv:Header>   
</xsl:template> 
</xsl:stylesheet>

incomig SOAP mesagge可以包含标头标签,也可能没有标头标签

输入没有标头标记的SOAP消息:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <hmhs-medical-acknowledgement id="4080186649" result="FAIL""/>
   </soapenv:Body>
</soapenv:Envelope>

使用标头标记输入SOAP消息:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>    
       <soapenv:Body>
          <hmhs-medical-acknowledgement id="4080186649" result="FAIL""/>
       </soapenv:Body>
 </soapenv:Envelope>

必需的输出SOAP消息:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header>
<UUID>71A4B2FA029D412787B06E07685ED101</UUID>
</soapenv:Header>
   <soapenv:Body>
      <hmhs-medical-acknowledgement id="4080186649" result="FAIL""/>
   </soapenv:Body>
</soapenv:Envelope>

有人可以帮助如何在其中添加SOAP标头。

1 个答案:

答案 0 :(得分:0)

AFAICT,你想做:

XSLT 1.0

SELECT
  id,
  stdID,
  name,
  MAX(CASE WHEN subject = 'Maths' THEN totalMarks ELSE NULL END) AS Maths,
  MAX(CASE WHEN subject = 'English' THEN totalMarks ELSE NULL END) AS English
FROM tablename
GROUP BY id,stdID,name
;