meder omuraliev
meder omuraliev

Reputation: 186662

XSLT - boolean true if attribute value character length greater than 10

I attempted this to count the total characters of my title attribute value, but it didn't seem to evaluate as I intended it to:

<xsl:if test="count(@title)>10">
    <xsl:attribute name="class">double-line</xsl:attribute>
</xsl:if>

I also tried to append /text() to @title. It looks like I'm still off. Any suggestions?

Upvotes: 2

Views: 16811

Answers (2)

Tim
Tim

Reputation: 9172

You want the string-length function:

<xsl:if test="string-length(@title) &gt; 10">

Upvotes: 11

AakashM
AakashM

Reputation: 63358

I believe it's string-length() you are after.

Upvotes: 2

Related Questions