<xsl:variable name="sChorus" select="chorus"/>
<xsl:variable name="len" select="string-length($sChorus)"/>
但后来我就发现了问题.如果节点间有回车等字符,就会被认为值>1.所以后来又用了一个函数去掉字符串中的空白.如下所示:<xsl:variable name="len" select="string-length($sChorus)"/>
<xsl:variable name="sChorus" select="chorus"/>
<xsl:variable name="len" select="string-length(normalize-space($sChorus))"/>
<xsl:variable name="len" select="string-length(normalize-space($sChorus))"/>