SharePoint XSLT Compare Strings

I found out the hard way that's always a good idea to trim your string when comparing them in xslt.

After a good amount of time scratching my head trying to figure out why two identical strings weren't registering as equal, I finally found a leading whitespace in one of the strings.

To preserve my mental health in the future I'll always be trimming my XSLT strings before comparing them.

 <xsl:if test="normalize-space($DisplayTitle) != normalize-space($SafeLinkUrl)">
        <xsl:value-of select="$DisplayTitle"/>
Dércia Silva
Posted by Dércia Silva on May 13, 2016

Related articles