我想将每个“字符串”节点打印为来自以下 xml 的 li 项:
<soapenv:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.url.org/url/envelope/"
>
<soapenv:Header>
<MultiSpeakMsgHeader
Version="" UserID=""
Pwd="" AppName="xx" AppVersion="x"
Company="xxx" xmlns="http://www.url.org/Version_3.0"
/>
</soapenv:Header>
<soapenv:Body>
<GetMethodsResponse xmlns="http://www.url.org/Version_3.0">
<GetMethods>
<string>GetDomainMembers</string>
<string>GetDomainNames</string>
<string>GetMethods</string>
<string>pingURL</string>
<string>GetAllMeters</string>
<string>GetAllServiceLocations</string>
<string>GetAllCustomers</string>
<string>GetCustomerByCustId</string>
<string>GetServiceLocationByAccountNo</string>
<string>GetServiceLocationByMeterNo</string>
<string>ReadingChangedNotification</string>
</GetMethods>
</GetMethodsResponse>
</soapenv:Body>
</soapenv:Envelope>
我目前有以下 xsl 代码 -
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exslt="http://exslt.org/common"
>
<xsl:output method="html" />
<xsl:template match="/GetMethods">
<ul>
<xsl:for-each select="GetMethods/string">
<li>
<xsl:value-of select="string"/><br/>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
但这所做的只是将每个字符串节点打印为没有列表格式的长行。任何帮助,将不胜感激。
我想要这个简单的输出:
<ul>
<li>GetDomainMembers</li>
<li>GetDomainNames</li>
<li>GetMethods</li>
<li>pingURL</li>
<li>GetAllMeters</li>
<li>GetAllServiceLocations</li>
<li>GetAllCustomers</li>
<li>GetCustomerByCustId</li>
<li>GetServiceLocationByAccountNo</li>
<li>GetServiceLocationByMeterNo</li>
<li>ReadingChangedNotification</li>
</ul>
我目前正在得到这个输出(没有格式):
GetDomainMembers GetDomainNames GetMethods pingURL GetAllMeters GetAllServiceLocations GetAllCustomers GetCustomerByCustId GetServiceLocationByAccountNo GetServiceLocationByMeterNo ReadingChangedNotification