Spaces in XSLT

Ever had a problem with rendering spaces in XSLT? I have. Most text can be placed directly in XSLT; however, when the text contains only a space, nothing will be rendered.

Example

<xsl:value-of select="@ProjectName"/> <xsl:value-of select="@ProjectStatus"/>


Example result

 ProjectnameGood

 

Solution
Place the space between the text tags and the space will be rendered correctly.

<xsl:value-of select="@ProjectName"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@ProjectStatus"/>


Result

 Projectname Good

Share

One Reply to “Spaces in XSLT”

Leave a Reply

Your email address will not be published. Required fields are marked *