Is it possible to apply normalize-space to all nodes XPath expression finds?

后端 未结 2 676
悲哀的现实
悲哀的现实 2020-12-06 11:26

Consider simple XML document:


Item 1
Item 2
2条回答
  •  忘掉有多难
    2020-12-06 11:52

    If you're using XPath 2.0 you can just use /html/body/table/tr/td/normalize-space(.).

    If you're stuck with XPath 1.0, I don't believe this is possible. You'll just have to loop over the resulting strings and normalize them.

提交回复
热议问题