Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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>

</xsl:for-each>
....
....

Xml generated:

+ ' <BOOK Description ="sdfdfdfdgfgfg
fgfgfgfgfgfg
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

share|improve this question

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.

share|improve this answer
    
Thanks:) but it is not working for me. I have tried using <xsl:value-of select="translate(./@Description,'&lt;br&gt;','\\n')"/> –  sharmila Feb 7 '12 at 9:34
    
but why are you replacing to '\\n'? replace to empty string ''. –  Andrey Markeev Feb 8 '12 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

share|improve this answer
    
Thanks :) But where can I find the itemstyle.xsl ?? I am using WSS 3.0 –  sharmila Feb 7 '12 at 6:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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