The description you give inherently changes the structure of the data, and JavaScript would be the best way to post-process it. CSS is about styling the structure of HTML, not structural changes to it.

Unless you have a good example, I think you’re coming at this from an “everything’s a nail if the only tool I have is a hammer”.

CSS if for styling of semantic structure of HTML, XSLT is a language to convert normalized data to semantic structure. That's what I gave an explanation about, I wasn't talking about CSS.