locked
HTML formatting tags in XSLT getting lost RRS feed

  • Question

  • I have a notification services application up and running that sends notifications using email, and I am trying to format the event data in the XSLT. When the event data is created, it's formatted for nvarchar(max), using char(13) to insert the carraige returns.

    In the XSLT to generate the email, I use the following in an attempt to format the text.

    In the notification match template
          <xsl:call-template name="line-breaks">
            <xsl:with-param name="text" select="EventData"/>
          </xsl:call-template>

    Formatting template
      </xsl:template>
      <xsl:template name="line-breaks">
        <xsl:param name="text"/>
        <xsl:choose>
          <xsl:when test="contains($text,'&#13;')">
            <xsl:value-of select="substring-before($text,'&#13;')"/>
            <br/>
            <xsl:call-template name="line-breaks">
              <xsl:with-param name="text"  select="substring-after($text,'&#13;')"/>
            </xsl:call-template>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="$text"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:template>

    I've used this template many times in the past, so I know it works. However, when I use it here, the formatting doesn't work, and the HTML is never inserted. I thought that the Char(13) was getting stripped by NS, but after replacing char(13) with a string 'linebreak', I'm still not getting the format. Is there some reason why call-template would not work in a notification services XSLT? Any other suggestions for formatting the HTML in the email?

    Thanks
    Erick 

    Saturday, May 13, 2006 12:35 AM

All replies

  • Are you restarting the NSInstance service between modifications of the XSLT file? SSNS caches the file for efficiency.

    If the data is missing, you may want to double check everything for typos, capitalization issues, etc.

    HTH...

    Wednesday, May 24, 2006 11:37 AM
  •  

    Hello

    I seem to have the same problem after i upgraded to asp.net 2.0

    Did anyone know this fix in xslt ?

    Thanks

    Cheers

     

    Friday, June 16, 2006 4:50 PM