Developer forum

Forum » Templates » DataList XSLT value of RitchTextEditor

DataList XSLT value of RitchTextEditor

Dmitrij Jazel
Reply

Hello DW guys,

I am trying to make an XSLT that could parse all that News and convert them into RSS.

This RSS MUST have special format.... that is why I am using this this module to achieve this.

Here is the xslt file (see file attached).

Everything works fine except for <description> tag. This tag must return just plain text.

Instead it returns "<p>abc</p>åøæ" - in short words it returns RitchTextEditor content - as that where this value is being taken.

what RSS feed validator sees: 

 <description>I ugerne 44, 45, 46, 47 og 48 f&amp;aring;r abc bes&amp;oslash;g af brobygningselever. Alle er fra tiende ydelse.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Se n&amp;aelig;rmere info herom i under.</description>

So - I found the way to get rid of HTML elements "&gt;" and "&lt;" etc... But even bigger problem is how can I transform "&amp;aring;" into "å".

Long story short - the value I am getting from RitchTextEditor I must convert it to just plain text.

encoding does not really help utf-8 or 16...

disable-output-escaping helps a bit, it converts nordic "æ" caracters to "&aelig;" but than the problem the problem is all HTML lements like here:

<h2 class="h2">Hj&aelig;lp <br />
&nbsp;</h2>
<img alt="" width="400" height="264" src="/files/billeder/Diverse/a.jpg" /><br />
<br />
Onsdag d. 3. november Dagsv&aelig;rk. I &aring;r er der,.&nbsp;<br />

I think this is the way to go, just not sure how can I remove all that RitchTextEditor markup...

Can anyone please help me here? :-(

Kind regards,

Dmitrij

 


Replies

 
Morten Bengtson
Reply
This post has been marked as an answer

Hi Dmitrij,

Does the feed need to be in RSS format? RSS does not work reliably with HTML content and transforming the html with xslt can lead to problems. 

I would recommend that you use the Atom format instead, which is a lot more flexible and supports HTML content... http://www.atomenabled.org/developers/syndication/#text

/Morten

 

Votes for this answer: 1
 
Dmitrij Jazel
Reply

Hej Morten,

Well this sounds like something I could use, I will try to take a look at this... I just really hope this works :-(

I will let you know about my findings. But if somone has answer how can I remove all that html - still would be great.

Thanks so far Morten :-) let's see how that special RSS reader likes Atoms...

Regards,

Dmitrij

 
Dmitrij Jazel
Reply

Hej Morten,

 

This actually worked!!! :)))

But now I have another problem.

Atom RSS Requires RFC-3339 time formatting

that is correct: 2012-11-08

What I get from Datalist module : 10/1/2010 10:40:00 AM     <-- and this one here is not correct.

Any way how to bypass this one?

Thanks alot for help! :-)

Regards,

Dmitrij

 

 
Morten Bengtson
Reply

You should be able to format the date by using the SQL function convert. http://www.sql-server-helper.com/tips/date-formats.aspx

It might be possible in XSLT, but I don't know how :)

/Morten

 

 
Morten Bengtson
Reply

Try this...

SELECT *, CONVERT(VARCHAR(10), NewsDate, 120) AS [NewsDateFormatted] FROM [News] ORDER BY [NewsID] DESC

...and then use NewsDateFormatted in the XSLT instead of NewsDate.

 
Dmitrij Jazel
Reply

Hej Morten :-)

Thanks again, well I just found a link here, and made a xslt template call when I am calling for news date.

http://www.daniweb.com/software-development/xml-xslt-and-xpath/threads/294146/xsl-format-date

Still thanks alot for help! :-)))

Have a great day!

Dmitrij

 

 

You must be logged in to post in the forum