首页 > 解决方案 > Xpath 多重格式化输出

问题描述

xml在一个文件中有很多条目并且xpath有条件:

/XMLReport/Report/PreflightResult/PreflightResultEntry[
  @type = 'Check' and @level = 'warning']/PreflightResultEntryMessage/Message/text()

输出是:

onetwothreefour...  and more

我需要分离

'---' one---two---three---four 

或者

[enter]
one
two
three
four

这是可能的 ?

标签: xpath

解决方案


为什么将 XPath 表达式绑定在单引号内'

用这个:

string-join(/XMLReport/Report/PreflightResult/PreflightResultEntry[@type = 'Check' and @level = 'warning']/PreflightResultEntryMessage/Message/text(), '---')

推荐阅读