0
我要排除此表中的IMG值:需要帮助:XPath查询
<table class="info">
<tbody>
<tr><th class="round-top" colspan="2">Status</th></tr>
<tr class="even">
<td class="key">Schaltprogramm aktiv</td>
<td class="value"><img height="15" src="./pics/ste-symbol_an-97b765.png"></td>
</tr>
</tbody>
</table>
我要排除此表中的值:
<table class="info">
<tbody>
<tr><th class="round-top" colspan="2">Warmwasser</th></tr>
<tr class="even">
<td class="key">WW-Isttemp.</td>
<td class="value">49,0 °C</td>
</tr>
<tr class="odd">
<td class="key round-leftbottom">WW-Solltemp.</td>
<td class="value round-rightbottom">46,5 °C</td>
</tr>
</tbody></table>
这里是我的不好的测试:
$nodelist = $xpath->query("//tr/td[substring(@class,1,5)='value']");
$imgs = $xpath->query("//table[@class='info']/tr/td/img");
我必须做些什么来排除变量“nodelist”中的IMG值?
有什么想法?
XPath是XML文档的* query *语言。因此,XPath表达式不能更改文档(通过创建或删除节点)。你需要做的是将文档转换成另一个XML文档。 XSLT是一种特别为XML转换而设计的语言,而这种特定的转换对于XSLT来说是微不足道的。你会对获得XSLT解决方案感兴趣吗? –