-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>
输出现在我得到的是只是没有数据肥皂模板。
会很感激,如果有人可以帮助:)
干杯!