使用 ,(逗号)和使用 | 有什么区别? (管道)在 'except' xslt 中?
What is the difference between use of , (comma) and use of | (pipe) in 'except' xslt?
<xsl:apply-templates select="node() except ($Abbr, $PrPostNum, $DocType, $DocSize)"/>
<xsl:apply-templates select="node() except ($Abbr | $PrPostNum | $DocType | $DocSize)"/>
想知道上面的区别……
没有区别。在这两种情况下,$Abbr
、$pRPostNum
等中的所有节点都从 node()
选择的节点集中消除。唯一的区别是,使用联合运算符 |
时,except()
的 right-hand 侧的重复项会首先被消除,但此类重复项对最终结果没有影响,因此无关紧要无论您是否这样做——除了可能在性能方面(当然,这完全取决于实现)。
<xsl:apply-templates select="node() except ($Abbr, $PrPostNum, $DocType, $DocSize)"/>
<xsl:apply-templates select="node() except ($Abbr | $PrPostNum | $DocType | $DocSize)"/>
想知道上面的区别……
没有区别。在这两种情况下,$Abbr
、$pRPostNum
等中的所有节点都从 node()
选择的节点集中消除。唯一的区别是,使用联合运算符 |
时,except()
的 right-hand 侧的重复项会首先被消除,但此类重复项对最终结果没有影响,因此无关紧要无论您是否这样做——除了可能在性能方面(当然,这完全取决于实现)。