I am working with SharePoint library and DataView webpart. I have a SharePoint list in which one of the column is a multi-line text. I have inserted a DataView webpart in the designer using the list. In code behind I am acessing the Columns of the list and generating the xml string out of it. But when I access the column with multi-line text the xslt causes line breaks in xaml string which I dont want. Can any one tell me how can I get rid of the line breaks? Below is the xslt. *Description * is the column with multi-line

<xsl:for-each select="/dsQueryResponse/Rows/Row">

<xsl:text disable-output-escaping="yes"><![CDATA[+ ' <BOOK Description ="]]></xsl:text>

<xsl:value-of select="./@Description " />
       <xsl:text disable-output-escaping="yes"><![CDATA[" PRICE="]]></xsl:text>
<xsl:value-of select="@price" />

<xsl:text disable-output-escaping="yes"><![CDATA["/>']]></xsl:text>


Xml generated:

+ ' <BOOK Description ="sdfdfdfdgfgfg
sharmila" PRICE="45"/>'
+ ' </BOOK>' 

The above xml generated has unwanted line-breaks I need the xml to be generated as below.

+ ' <BOOK Description ="sdfdfdfdgfgfgfgfgfgfgfgfgsharmila" PRICE="45"/>'
+ ' </BOOK>'  

Thanks and Regards, Sharmila

2 Answers 2


Please, try to replace your <xsl:value-of select="./@Description " /> with the following code:

<xsl:value-of select="translate(./@Description,'&#xA;','')"/>

This should remove all line breaks from the Description column.

  • Thanks:) but it is not working for me. I have tried using <xsl:value-of select="translate(./@Description,'&lt;br&gt;','\\n')"/>
    – sharmila
    Commented Feb 7, 2012 at 9:34
  • but why are you replacing to '\\n'? replace to empty string ''. Commented Feb 8, 2012 at 18:34

Please go through the below post .I hope this would help you http://www.thesug.org/Blogs/kyles/Lists/Posts/ViewPost.aspx?ID=28&RootFolder=%2FBlogs%2Fkyles%2FLists%2FPosts

  • Thanks :) But where can I find the itemstyle.xsl ?? I am using WSS 3.0
    – sharmila
    Commented Feb 7, 2012 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.