The Blog

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:

XML:
  1. <input type="submit">
  2. <xsl:attribute name="value">
  3. Login
  4. </xsl:attribute>
  5. </input>

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

XML:
  1. <input type="submit">
  2. <xsl:attribute name="value">Login</xsl:attribute>
  3. </input>

all looks ok:

Screenshot from IE, with bug prevented

XSLT is slowly killing me…

Banca

Banca

Beautiful and functional currency converter, supports just about any currency in the world.

Go Couch to 5k

Go Couch to 5k

The most popular starter running program in beautiful feature-rich app (GPS tracking, charts, detailed history etc)

Quickie to do

Quickie to do

The fastest short-term task-list / check-list app on the App Store. Really.

Guerrilla Cardio

Guerrilla Cardio

The most challenging high-impulse interval training in the world.

Run Mate

Run Mate

A versatile running coach app, with unlimited number of running programs. Perfect for casual runners.

2 Comments

Feel free to chime in, looking forward to it. Leave a Comment

  1. Dejan Vesić says:

    Well, XSLT is ugliest of all scripting languages — it is so ugly that is should not be called language.

    Even old ASP is better.

  2. sam says:

    here is something for you i found very usefull for controlling xsl behaviour toward whitespace:

    http://www.xml.com/pub/a/2001/11/07/whitespace.html

Leave a Comment

Add your comment here, just please be civilized and stay on topic.