답변됨 how to disable html encoding in xslt data view in sharepoint pages

  • Wednesday, February 15, 2012 5:24 AM
     
     

    hi, 

    I have an xslt dataview webpart in a sharepoint blog page. In descripition column, the &, >, < are getting converted into &amp;, &gt, &lt, etc .

    How to disable this encoding?.

    ______________________________________________________________

    <xsl:otherwise>
    <xsl:variable name="VarIDADZITB" select="ddwrt:SetVar('HasBody', '1')" />
    <xsl:text disable-output-escaping="yes">&lt;TR&gt;</xsl:text>
    <TD colspan="2"><font color="#333333" face="Arial, Helvetica, sans-serif" size="2"><div dir="{ddwrt:GetVar('Direction')}"><xsl:value-of disable-output-escaping="yes" select="ddwrt:AutoNewLine(string(@Body))" /></div></font></TD>
    </xsl:otherwise>
    ______________________________________________________________

    this is the piece of code, im using for displaying the body. 



    pepsin s

All Replies

  • Friday, February 17, 2012 11:29 AM
    Moderator
     
     Proposed Answer Has Code

    Hi Pepsin,

    Is the description column named Body in your code ?

    Remove the ddwrt:AutoNewLine and check result again.

    <xsl:value-of disable-output-escaping="yes" select="@Body"/>

    http://blog.pathtosharepoint.com/2009/07/26/html-calculated-column-and-data-view-web-part/

    Thanks


    Daniel Yang

    TechNet Community Support

    • Proposed As Answer by CParikh Thursday, March 01, 2012 7:47 PM
    •  
  • Monday, February 20, 2012 10:49 AM
     
     

    thanks Daniel, now & and < s are looking fine,

    But now the line break is gone, and the description is displayed as a single paragraph. even if we enter the text line by line, they are getting combined into a single paragraph.


    pepsin s

  • Tuesday, February 21, 2012 9:57 AM
    Moderator
     
     Answered Has Code

    Hi Pepsin,

    The code worked for me, you can re-test with a simple dataview webpart in your SharePoint site,

    <xsl:value-of disable-output-escaping="yes" select="ddwrt:AutoNewLine(string(@RichTextColumn))" />

    And you need to check the "Body" column from SharePoint Designer 2007 whether it is set as "Format as: Rich Text" per the following article,

    http://www.wssdemo.com/Blog/archive/2006/05/22/common-xslvalue-of-tasks-in-sharepoint-designer.aspx

    Thanks


    Daniel Yang

    TechNet Community Support

  • Thursday, March 01, 2012 7:47 PM
     
     

    Thank you... I had a similar problem and this really helped me resolve my issue....