I'm transforming some XML, which I have no control over, to XHTML. The XML schema defines a <para>
tag for paragraphs and <unordered-list>
and <ordered-list>
for lists.
Frequently in this XML, I find lists nested within paragraphs. So, a straight-forward transformation causes <ul>
s to get nested within <p>
s, which is illegal in XHTML.
I've created a list of ways to deal with it and here are the most obvious:
- Just don't worry about it. The browsers will do fine. Who cares. (I don't like this option, but it's an option!)
- Write a fancy-pants component to my transform that makes sure all
<para>
tags get closed before unordered lists start, and re-opened afterward. (I like this option the most, but it's complicated due to multiple levels of nesting, and we may not have the budget for this) - Just transform
<para>
to<div>
and set the margins on the divs so it looks like a paragraph in the browser. This is the easiest solution that emits valid XHTML, but it takes from the semantic value of the markup.
My question is, how much value do I lose if I go with option 3? Does it really matter? What is the actual effect on the user experience? If you can cite references, please do (this is easy to speculate on).
For example, I was thinking it might affect search results from a Google Search Appliance that we are using. If search terms appear in divs, do they carry less weight? Or is there less of an association between them and preceding header tags? How can I find this out?