0

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

2 Answers 2

1

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.

2
  • 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, 2012 at 9:34
  • but why are you replacing to '\\n'? replace to empty string ''. Feb 8, 2012 at 18:34
0

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

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

Your Answer

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

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