检查变量XSL中的字符数

NWh*_*ite 2 xslt

您好基本上我需要找到使用XSL的变量中有多少个字符

if characters($Title == 12) {  
    execute code;
}
Run Code Online (Sandbox Code Playgroud)

基本上像上面的东西显然这是不正确的任何人可以帮助?

小智 9

或者,您可以在XSL中执行等效于和if/else语句:

<xsl:choose>
  <xsl:when test="string-length($Title) = 12">
    <!-- code when the check is true -->
  </xsl:when>
  <xsl:otherwise>
    <!-- code when it's false -->
  </xsl:otherwise>
</xsl:choose>
Run Code Online (Sandbox Code Playgroud)