Media item html tags stripped off in Razor and escaped in xslt
I've set up a system where an xml doc is uploaded via a specific Media Type. The AfterSave event parses the XML (using xslt) to convert it to HTML. The HTML is then stored in a RichText Property on the media item.
This works well, until I try to output the converted HTML to a page. Razor macros strip the HTML tags and xslt macros xml encode it.
I can handle the xslt (at a push), but really I want to use Razor, and the behaviour seems very odd. @Html.Raw has no effect.
And this is the data stored in cmsPropertyData following a save:
<div class="doc"> <p><span style="">This is my test doc … </span></p> <p></p> <p></p> <p><span style="">Lets</span><span style=""> see what is looks like</span></p> </div>
If I can get this to work it will be soo cool, maybe even my first published package. Any help greatly appreciated.
Media item html tags stripped off in Razor and escaped in xslt
I've set up a system where an xml doc is uploaded via a specific Media Type. The AfterSave event parses the XML (using xslt) to convert it to HTML. The HTML is then stored in a RichText Property on the media item.
This works well, until I try to output the converted HTML to a page. Razor macros strip the HTML tags and xslt macros xml encode it.
I can handle the xslt (at a push), but really I want to use Razor, and the behaviour seems very odd. @Html.Raw has no effect.
This is my AfterSave event code:
And this is the data stored in cmsPropertyData following a save:
If I can get this to work it will be soo cool, maybe even my first published package. Any help greatly appreciated.
Thanks,
Fran
Did you ever figure this out? I posted this two days ago which seems like the same problem : http://our.umbraco.org/forum/developers/razor/31803-Richtext-editor-property-on-a-Media-type-HTML-tags-are-stripped-when-rendered
This behavior is indeed a bit... odd.
In the end I gave up and used xslt!
Boo
This is indeed a serious limitation/bug of umbraco/razor relation. We cannot use XML/HTML datatypes in media items.
My new working theory is that the HTML is stripped upon being either cached and/or retrieved by the UmbracoExamine engine when dealing with Media.
I'm thinking the Razor engine is not the one responsible for this, I'm just not sure how to prove it (or fix it).
Thank you!
is working on a reply...