Ivaldi has become a part of ReMark! Read more about it here.

XSLT eating whitespace

I wanted to fill an HTML tag with three data nodes using <xsl:value-of select="the/node/path" /> and seperate them with whitespace. My first thought was a construction like this in my <xsl:template match="/data/klant/entry">

<td><xsl:value-of select="voornaam" /> <xsl:value-of select="tussenvoegsel" /> <xsl:value-of select="achternaam" /></td>

However, this will result in the white space between the <xsl:value-of> statements being removed. After posting on the Symphony CMS forum, nickdunn suggested using this solution:

<td><xsl:value-of select="concat(voornaam, ' ', tussenvoegsel, ' ', achternaam)" /></td>

As you can see, this will even make the code more readable. Thanks Nick!

Ivaldi has become a part of ReMark! Read more about it here.