我有一个如下所示的 SOAP 请求;
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetCountriesResponse xmlns="url">
<GetCountriesResult>
<ExtendedOptionItem>
<Value>GB</Value>
<Description>United Kingdom</Description>
<Active>true</Active>
<IsDefault>true</IsDefault>
<Order>0</Order>
</ExtendedOptionItem>
<ExtendedOptionItem>
<Value>GB</Value>
<Description>United Kingdom</Description>
<Active>true</Active>
<IsDefault>true</IsDefault>
<Order>0</Order>
</ExtendedOptionItem>
</GetCountriesResult>
</GetCountriesResponse>
</soap:Body>
</soap:Envelope>
我的 XSLT 目前专门针对“描述”节点。我想做的是提取每个“ExtendedOptionItem”的描述。
我已经编写了一些需要用分号分隔每个描述的 XSLT。
当只有一个“ExtendedOptionItem”时,此 XSLT 工作得非常好。但是,当有多个项目时,XML 不会被转换。
请您查看我的 XSLT 并评估我哪里出错了;
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<xsl:output method="xml" omit-xml-declaration="no" encoding="utf-8" indent="yes" />
<xsl:template match="/">
<xsl:for-each xmlns:n="url" select="n:ExtendedOptionItem">
<xsl:value-of select="n:Description" />;</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
非常感谢
更新;
SOAP 响应被 Workflow Engine 修改为如下所示;
<ExtendedOptionItem xmlns="url"><Value>GB</Value><Description>United Kingdom</Description><Active>true</Active><IsDefault>true</IsDefault><Order>0</Order></ExtendedOptionItem><ExtendedOptionItem xmlns="url"><Value>AF</Value><Description>Afghanistan</Description><Active>true</Active><IsDefault>false</IsDefault><Order>0</Order></ExtendedOptionItem><ExtendedOptionItem xmlns="url"><Value>AX</Value><Description>Åland Islands</Description><Active>true</Active><IsDefault>false</IsDefault><Order>0</Order></ExtendedOptionItem>