tags:

views:

527

answers:

2

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?

+2  A: 

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

AakashM
+5  A: 

You want the string-length function:

<xsl:if test="string-length(@title) &gt; 10">
Tim
`"<"` and `">"` should be XML-encoded.
Tomalak
Er - gt and lt instead of the literal?
meder