MarkLogic xdmp:quote 的文档没有选项示例
The documentation for MarkLogic's xdmp:quote does not have an example for the options
我想在 XML 未缩进的情况下执行以下操作:
xdmp:quote(fn:doc($uri)/*)
https://docs.marklogic.com/xdmp:quote 的文档不是很清楚。选项参数应该如何格式化?
尝试使用以下选项参数:
let $options :=
<options xmlns="xdmp:quote">
<indent>no</indent>
</options>
return xdmp:quote(fn:doc($uri)/*, $options)
quote options are listed in the documentation for the xdmp:quote()
函数。
有关所有选项的完整列表,您可以在安装区域的 /MarkLogic/Config 目录中找到 quote.xsd 文件。
它相对简单,与在其他命令中的使用方式没有什么不同,例如 xdmp:http-get 和 xdmp:eval:
xdmp:quote(
$xml,
<options xmlns="xdmp:quote">
<omit-xml-declaration>yes</omit-xml-declaration>
<indent>no</indent>
<indent-untyped>no</indent-untyped>
</options>
)
注意,这不会去除 XML 中存在的白色 space。要摆脱它,您可以使用旧的 xsl:strip-space:
xdmp:quote(
xdmp:xslt-eval(
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="#all">
<xsl:output indent="no" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>,
$xml
)
)
HTH!
我想在 XML 未缩进的情况下执行以下操作:
xdmp:quote(fn:doc($uri)/*)
https://docs.marklogic.com/xdmp:quote 的文档不是很清楚。选项参数应该如何格式化?
尝试使用以下选项参数:
let $options :=
<options xmlns="xdmp:quote">
<indent>no</indent>
</options>
return xdmp:quote(fn:doc($uri)/*, $options)
quote options are listed in the documentation for the xdmp:quote()
函数。
有关所有选项的完整列表,您可以在安装区域的 /MarkLogic/Config 目录中找到 quote.xsd 文件。
它相对简单,与在其他命令中的使用方式没有什么不同,例如 xdmp:http-get 和 xdmp:eval:
xdmp:quote(
$xml,
<options xmlns="xdmp:quote">
<omit-xml-declaration>yes</omit-xml-declaration>
<indent>no</indent>
<indent-untyped>no</indent-untyped>
</options>
)
注意,这不会去除 XML 中存在的白色 space。要摆脱它,您可以使用旧的 xsl:strip-space:
xdmp:quote(
xdmp:xslt-eval(
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="#all">
<xsl:output indent="no" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>,
$xml
)
)
HTH!