Name

FixAmpersands

See my blog post Are Ampersands Stored Differently in SharePoint 2010 Than SharePoint 2007?

Example

<xsl:call-template name="FixAmpersands">
  <xsl:with-param name="StringValue" select="@Title"/>
</xsl:call-template>

Code

<xsl:template name="FixAmpersands">
  <xsl:param name="StringValue"/>
  <xsl:variable name="Ampersand" select="'&amp;'" />
  <xsl:choose>
    <xsl:when test="contains($StringValue, $Ampersand)">
      <xsl:value-of select="concat(substring-before($StringValue, $Ampersand), '&amp;amp;', substring-after($StringValue, $Ampersand))"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$StringValue"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Last edited Jun 13, 2012 at 4:26 AM by sympmarc, version 3

Comments

No comments yet.