Saxon在XSLT期间是否在属性中使用空格?
我想知道Saxon在XSLT期间如何以及为什么在XSL元素之间使用空格。以下是一个可能受上述行为影响的示例: 在XSLT期间,Saxon如何以及为什么在XSL元素之间使用空格?Saxon在XSLT期间是否在属性中使用空格?,xslt,saxon,Xslt,Saxon,我想知道Saxon在XSLT期间如何以及为什么在XSL元素之间使用空格。以下是一个可能受上述行为影响的示例: 在XSLT期间,Saxon如何以及为什么在XSL元素之间使用空格? <div style="display:none;"> <xsl:choose> <xsl:when test="true"> <xsl:attribute name="id"> <xsl:choose>
<div style="display:none;">
<xsl:choose>
<xsl:when test="true">
<xsl:attribute name="id">
<xsl:choose>
<xsl:when>
etc ec
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</div>
除非样式表中的某个父元素上碰巧有属性xml:space=“preserve”,否则只包含空格的文本节点(如示例中的文本节点)没有任何效果(它们在解析的早期阶段被删除)。(出于这样的原因,将xml:space=“preserve”放在样式表中几乎总是坏消息,但人们时不时地这样做,这可以解释这里的问题。)
另一种可能性(我12年才见过一次…)是看起来像空白的东西不是。例如,它可能包含非中断空格或零宽度空格,这些空格看起来是白色的,但不是正式的空白。第一个
XSLT attribute node (id) cannot be created after the children of the containing element