如何在 returns 多个结果的 xmllint 查询中插入分隔符

How can I insert separator characters in a xmllint query that returns several results

大家好,你们这些聪明人:-) 我正在从 AppleScript 调用 shell 脚本以从 xml 文件中获取值。该文件(已简化!)如下所示:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProductHints spec="1.0.16">
  <Product version="4">
    <Name>The Product Name</Name>
    <Company>The Company Name</Company>
    <PRODID>A123</PRODID>
  </Product>
</ProductHints>

我的 AppleScript 看起来像这样:

set thePath to "/Path/to/my/file.xml"
set theResult to do shell script "xmllint " & quoted form of thepath & " --xpath '/ProductHints/Product/Name/text() | /ProductHints/Product/PRODID/text() | /ProductHints/Product/Company/text()'"
display dialog theResult

因此,这显示: 产品名称公司名称A123

这确实是必需的信息,但没有多大用处! 我希望结果是制表符分隔或逗号分隔(制表符是理想的,但我可以使用逗号!)例如:

The Product Name **Tab** The Company Name **Tab** A123

The Product Name, The Company Name, A123

我确定有一个简单的解决方案可以在每个项目之间放置一些东西,但我尝试了各种方法都无济于事!

请哪位好心人帮帮我。提前致谢。

糟糕!那个代码块有点乱。我会再试一次:

set thepath to "/Path/to/My/file name.xml"
 set theScript to "xmllint --xpath \"concat(/ProductHints/Product/Name/text(),',',/ProductHints/Product/PRODID/text(),',',/ProductHints/Product/Company/text())\" " & quoted form of thepath
 set theResult to do shell script theScript without altering line endings
display dialog theResult