gpt4 book ai didi

html - 需要在单引号 xslt 中分配属性值

转载 作者:数据小太阳 更新时间:2023-10-29 02:30:51 25 4
gpt4 key购买 nike

我们需要使用 xslt 转换从 xml 创建 html。我们需要生成的 html anchor 标记为

<a>
<xsl:attribute name="href">
<xsl:value-of select="Google-Link" />
</xsl:attribute>
</a>

输出 html 在双引号中有 href 属性值 <a href="http://google.com">google</a> 但我们希望它用单引号 <a href='http://google.com'>google</a>

最佳答案

除非您的 XSLT 处理器供应商为您提供延期请求,否则您无法控制。此类序列化选择由处理器做出,不能使用标准化机制在 XSLT 样式表中指定。处理器可能会提供此功能,但我还没有看到它(并不是说我已经看过......从 XML 的角度来看,无论选择何种属性定界符,结果信息集都不会改变)。

为什么属性定界符的选择对您的信息处理很重要?您必须在数据流中使用非 XML 步骤才能引起关注。

引用:http://www.w3.org/TR/xslt-xquery-serialization/#serparam您的用例恰好是引用的示例:

In those cases where they have no important effect on the content of the serialized result, details of the output methods defined by this specification are left unspecified and are regarded as implementation-dependent. Whether a serializer uses apostrophes or quotation marks to delimit attribute values in the XML output method is an example of such a detail.

关于html - 需要在单引号 xslt 中分配属性值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18028446/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com