1
我想我有一個換行符輸出分離的新行內CONCAT,所以我嘗試:如何打印xmlstarlet
xmlstarlet sel -t -m "//node01" -v 'concat(@title,"\n",script/code)' -n input.xml
但是,什麼是印刷的是「\ n」字面值和輸出上同一條線。如何在concat()函數中強制換行?
樣本的input.xml是:
<test>
<aaa>This is a test</aaa>
<node01 title="howdy">
<script>
<code>function idoit() {
console.log("hello world");
}
</code>
</script>
</node01>
</test>
當我運行,輸出爲:
howdy\nfunction idoit() {
console.log("hello world");
}
當你嘗試'concat(@title,「 」,script/code)'時會發生什麼?是不是xmlstarlet只是簡單地從你的輸入中創建一些XSLT,然後字符引用可以工作? –
嗨馬丁,不錯的提示,但我試過它不起作用。 – ifelsemonkey