-1
首先,我將提供我已有的代碼。 XML:從SOAP響應中提取XSL字符串
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getUserDataResponse xmlns="http://wtp">
<getUserDataReturn>Matt</getUserDataReturn>
<getUserDataReturn>NY</getUserDataReturn>
</getUserDataResponse>
</soapenv:Body>
</soapenv:Envelope>
這是XSLT我有:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope">
<xsl:output method="xml" omit-xml-declaration="no" encoding="utf-8" indent="yes" />
<xsl:template match="/">
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getUserDataResponse xmlns="http://wtp">
<xsl:for-each select="soapenv:Envelope/soapenv:Body/soapenv:getUserDataResponse/soapenv:getUserDataReturn">
<xsl:value-of select="." />
</xsl:for-each>
</getUserDataResponse>
</soapenv:Body>
</soapenv:Envelope>
</xsl:template>
</xsl:stylesheet>
我想要做到的,是提取陣列的只有第一個元素,在這種情況下,字符串「馬特,然後把它喜歡它是隻是定期迴應,將其進一步發送到另一個端點「。我不知道什麼可能是不正確的。
輸出,我想:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getUserDataResponse xmlns="http://wtp">
<getUserDataReturn>Matt</getUserDataReturn>
</getUserDataResponse>
</soapenv:Body>
</soapenv:Envelope>
輸出現在我得到的是隻是沒有數據肥皂模板。
會很感激,如果有人可以幫助:)
乾杯!