如何在输出中制作单引号属性值 xml
How to make a single quote attribute value in the output xml
当我转换下面的 xml 文件时,它在输出中被转换为双引号:
我的输入XML:
<p outputclass="Center">Type</p>
XSL 我用作:
<xsl:template match="p[@outputclass = 'Center']">
<div class='center'><p>
<xsl:apply-templates/>
</p></div>
</xsl:template>
我得到的输出为:
<div class="center"><p>Type</p></div>
但我需要单引号中的输出
<div class='center'><p>Type</p></div>
我在输入中用单引号,但在转换时变成了双引号。由于该双引号,错误发生在 Json 转换中。谁能告诉我如何获得单引号,否则我们是否需要更改可能是必要的。我正在使用 XSLT 2.0 和 saxon-PE 9.6.0.7。
请给我一些建议
我不知道有任何 XML 序列化程序可以让您控制是将单引号还是双引号用作属性定界符。撒克逊人当然不会。如果有一个应用程序消耗 XML 并且需要一个或另一个,那么该应用程序有严重的错误,最好避免使用。
当我转换下面的 xml 文件时,它在输出中被转换为双引号:
我的输入XML:
<p outputclass="Center">Type</p>
XSL 我用作:
<xsl:template match="p[@outputclass = 'Center']">
<div class='center'><p>
<xsl:apply-templates/>
</p></div>
</xsl:template>
我得到的输出为:
<div class="center"><p>Type</p></div>
但我需要单引号中的输出
<div class='center'><p>Type</p></div>
我在输入中用单引号,但在转换时变成了双引号。由于该双引号,错误发生在 Json 转换中。谁能告诉我如何获得单引号,否则我们是否需要更改可能是必要的。我正在使用 XSLT 2.0 和 saxon-PE 9.6.0.7。
请给我一些建议
我不知道有任何 XML 序列化程序可以让您控制是将单引号还是双引号用作属性定界符。撒克逊人当然不会。如果有一个应用程序消耗 XML 并且需要一个或另一个,那么该应用程序有严重的错误,最好避免使用。