Hi there basically I need to find how many characters are in a variable using XSL
if characters($Title == 12) { execute code; }
Basically something like above obviously this is incorrect can any one help?
thanks in advance
Hi there basically I need to find how many characters are in a variable using XSL
if characters($Title == 12) { execute code; }
Basically something like above obviously this is incorrect can any one help?
thanks in advance
string-length($varname)
will tell you the length of a variable containing data that can be interpreted as a string.
In XPath 1.0:
string-length($title) = 12
Take notice that diacritical marks also would be counted.
In XPath 2.0 you cuold use:
string-length(normalize-unicode($title)) = 12
basically I need to find how many characters are in a variable using XSL
if characters($Title == 12) { execute code; }
Use:
<xsl:if test="string-length($Title) = 12">
<!-- Your code here -->
</xsl:if>
Alternatively you can do the equivalent to and if/else statement in XSL:
<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>