Programming

XSLT processing quirk

This week I encountered, for the second time in recent weeks, a very ugly XSLT quirk. I can’t call it a bug, as I’m relatively new to XSL, but it sure irks me very much. Continue reading, it might save you some sanity.

I must lead you to full page, as the code example can’t feet in the home page space.

Take a look at this lovely login form, in IE6 (same in IE7):

Screenshot from IE, with bug shown

It’s caused by this XSLT code:

	<input type="submit">

	<xsl:attribute name="value">

	Login

	</xsl:attribute>

	</input>

The value attribute is not just Login, but also all the white characters around it, most notably tabs. When written as this:

	<input type="submit">
	<xsl:attribute name="value">Login</xsl:attribute>
	</input>

all looks ok:

Screenshot from IE, with bug prevented

XSLT is slowly killing me…