0

我有一个文件:

<?xml version="1.0"?>
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude">
  <theme>
    <name>YYYY</name>
    <titleLayout>XXXX</titleLayout>
    <font place="ActiveWindow">
      <name>ZZZZ</name>
      <size>8</size>
    </font>
  </theme>
</openbox_config>

我可以使用以下命令更改<name>and的值:<titleLayout>

xmlstarlet ed -L -N a="http://openbox.org/3.4/rc" -u /a:openbox_config/a:theme/a:name -v YYYY test.xml

xmlstarlet ed -L -N a="http://openbox.org/3.4/rc" -u /a:openbox_config/a:theme/a:titleLayout -v XXXX test.xml

但我无法更改<name>& <size>under的值<font place="ActiveWindow">。我已经尝试过了,但没有奏效:

xmlstarlet ed -L -N a="http://openbox.org/3.4/rc" -u /a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:name -v AAAA test.xml

有什么帮助吗?

4

1 回答 1

1

引用您的路径以防止bash解释内容:

xmlstarlet ed -L -N a="http://openbox.org/3.4/rc" -u '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:name' -v AAAA test.xml
于 2020-06-13T10:59:21.323 回答