We have a simple XML file that has a single element with several attributes and CDATA inside. The portal template uses the XML Data Source and Basic Repeater webparts. The transformation works fine on the attributes with a simple Eval("attribute"), but numerous approaches haven't been able to pull the CDATA.
We're running v7.0.29, using the portal engine.
The XML file right now is in the CMS for development purposes, but ultimately we may want to point the XML Data Source webpart to an external file. The WHERE statement in the Data Source webpart is set to return only type='4030' — there are about 10 types in the XML file. The XML is structured like so:
<posts>
<post type="4030" file="posts1207.xml" date="12/7/2012" title="WILLIAM RHOLL">
<![CDATA[<p style="text-align:left;">#123456</p><p style="text-align:center;"><strong>WILLIAM RHOLL</strong></p>
<p style="text-align:center;"><strong>Posting</strong></p>
<p style="text-align:justify;text-justify:auto;">The Great, Magnificent Lebowski. No. 144677.</p>
<p style="text-align:justify;text-justify:auto;">Lebowski ipsum well sir, it's this rug I have, really tied the room together. Dolor sit amet, consectetur adipiscing elit praesent ac magna justo pellentesque ac lectus. When he moved down to Venice he had to go door-to-door to tell everyone he's a pederast.</p>
<p style="text-align:justify;text-justify:auto;">This Chinaman is not the issue! Suscipit malesuada non, ultrices non urna sed orci ipsum. Look at that freaking phony, Dude! Pretending to be a millionaire! Placerat id condimentum rutrum, rhoncus ac. Would it be possible for me to get my twenty grand in cash?</p>
<p style="text-align:left;">1234567</p>
<p style="text-align:left;">Dec 7, 2012</p>]]>
</post>
<post type="4030" file="posts1207.xml" date="12/7/2012" title="JOHN GOODMAN">
<![CDATA[<p style="text-align:left;">#123456</p><p style="text-align:center;"><strong>JOHN GOODMAN</strong></p>
<p style="text-align:center;"><strong>Posting</strong></p>
<p style="text-align:justify;text-justify:auto;">Vee belief in nossing, Lebowski. No. 1236677.</p>
<p style="text-align:justify;text-justify:auto;">I gotta check this with my accountant of course. Lorem aliquam placerat posuere neque.</p>
<p style="text-align:justify;text-justify:auto;">Nice marmot. Ut ultricies ipsum morbi eget risus nulla nullam vel nisi enim, vel auctor. All right, Plan B. You might want to watch out the front window there, Larry. Ante morbi id urna vel felis lacinia placerat vestibulum. They call Los Angeles the City of Angels.</p>
<p style="text-align:left;">7654321</p>
<p style="text-align:left;">Dec 7, 2012</p>]]>
</post>
</posts>
This transformation works OK in the Basic Repeater for the attributes:
<div><%# Eval("date") %> — <%# Eval("type") %> — <%# Eval("title") %></div>
These are some of the approaches I've tried for the CDATA, with numerous variations on each, but nothing has worked so far (And, no, I'm not a programmer):
<div><%# Container.DataItem["post"] %></div>
<div><%# HttpUtility.HtmlEncode(EvalCDATA("post",false)) %> —</div>
<div><%# IfEmpty(Eval("InnerHTML"), "fail", Eval("InnerXML")) %></div>
<div><%#((System.Xml.XmlNode)Container.DataItemObject).SelectSingleNode("post").InnerText %></div>
<div><%# System.Xml.XmlNode.SelectNodes(".").ToString() %></div>
<div><%# DataBinder.Eval(Container.DataItem, "['post']")%></div>
<div><%# XPath("post").XPathBinder.ToString() %></div>
<div><%# Container.DataItem("post")%></div>
<div><%# System.Data.DataRowView["."].ToString() %></div>
The first question is what transformation method will return the CDATA and render the HTML within it?
Ultimately, the page will have a drop-down menu to select the type and date and search within that type or date. The result list would show only the title as a link (or linkbutton), and clicking through would return that one item.
So the second question is what webparts do you recommend for achieving this? Would a filter in conjunction with the XML Data Source be the right approach?