在 xml 注释中写入表达式
Write expression inside xml comment
我想在输出中添加 xml 注释,并在注释中添加一些表达式。我怎样才能在 xquery 中做到这一点?如果我有
<!-- {$var} -->
它是按字面插入的,但我想在输出上添加一个注释标记,其 value 为 $var
这样的东西行得通吗?
for $x in /* return <x><![CDATA[<!--]]>{$x}<![CDATA[-->]]> </x>
输入
<test>hello comment</test>
输出
<!--hello comment-->
XQuery 有注释构造函数,例如:
<test>
{
let $x := 'hello world!'
return comment {$x}
}
</test>
产量:
<?xml version="1.0" encoding="UTF-8"?>
<test><!--hello world!--></test>
我想在输出中添加 xml 注释,并在注释中添加一些表达式。我怎样才能在 xquery 中做到这一点?如果我有
<!-- {$var} -->
它是按字面插入的,但我想在输出上添加一个注释标记,其 value 为 $var
这样的东西行得通吗?
for $x in /* return <x><![CDATA[<!--]]>{$x}<![CDATA[-->]]> </x>
输入
<test>hello comment</test>
输出
<!--hello comment-->
XQuery 有注释构造函数,例如:
<test>
{
let $x := 'hello world!'
return comment {$x}
}
</test>
产量:
<?xml version="1.0" encoding="UTF-8"?>
<test><!--hello world!--></test>