Aleksandar • Vacić

iOS bits and pieces

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:

1
2
3
4
5
6
7
8
9
<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:

1
2
3
<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…