我有xml文件:
<root>
<host>
<address addr="192.168.0.1" addrtype="ipv4"/>
<ports>
<port protocol="tcp" portid="10"></port>
<port protocol="tcp" portid="20"></port>
</ports>
</host>
<host>
<address addr="192.168.0.2" addrtype="ipv4"/>
<ports>
<port protocol="tcp" portid="30"></port>
<port protocol="tcp" portid="40"></port>
</ports>
</host>
<root>
我想得到这样的结果:
192.168.0.1 10,20
192.168.0.2 30,40
我正在使用 for-each (第一列):
<xsl:for-each select="root/host">
<xsl:value-of select="address/@addr"/></fo:block>
</xsl:for-each>
但是第二列是一个问题..我得到错误的结果:
192.168.0.1 10,20,30,40
192.168.0.2 10,20,30,40
请帮忙 :)