xmlstarlet добавить неразличимые строки

У меня есть следующий файл XML:

Я пытаюсь добавить следующее

<functions loglevel="error">
<function spreadsheet_function="GETTPOS"/>
<function spreadsheet_function="GETLPOS"/>
</functions>

Я выполнил следующее:

xmlstarlet ed -s "/_:php_macro_engine_config" -t elem -n "functions" -v "" -i "/_:php_macro_engine_config/functions" -t attr -n loglevel -v error
-s "/_:php_macro_engine_config/functions" -t elem -n "function" -i "/_:php_macro_engine_config/functions/function" -t attr -n spreadsheet_function -v GETTPOS
-s "/_:php_macro_engine_config/functions" -t elem -n "function" -i "/_:php_macro_engine_config/functions/function" -t attr -n spreadsheet_function -v GETLPOS 
macro_engine_config.xml

он создает следующее:

<function spreadsheet_function="GETTPOS" spreadsheet_function="GETLPOS"/>
<function spreadsheet_function="GETLPOS"/>

как я могу различать оба параметра xmlstarlet?


person laloune    schedule 27.07.2016    source источник
comment
отредактируйте, чтобы показать необработанный входной файл (ИЛИ исправьте свое объяснение ;-)). Удачи.   -  person shellter    schedule 27.07.2016
comment
Помогает ли этот ответ? stackoverflow.com/a/9172796/319698   -  person npostavs    schedule 28.07.2016