Transformation of XML into HTML: best practice?

libelis

New Member
I have XML like this:\[code\]<Artist name="Syd Mead" id="3412" ntrack="28" pop="8"/> \[/code\]Which I need to use in HTML markup:\[code\]<a href="http://stackoverflow.com/questions/10925970/#" data-name="Syd Mead" data-id="3412" data-ntrack="28" data-pop="8" class="pop-8"><span>Syd Mead</span></a>\[/code\]What is the "right" way to do this for the widest array of browsers? Can this be done reliably with a XSLT transformation? Is it better to use a regex (unlikely) or do I have to parse out the xml, and for each \[code\]<Artist>\[/code\] tag read each attribute and do document.createElement and setAttribute manually? The \[code\]<Artist>\[/code\] tags are in a parent node, there's many of them. Is there a best practice for this?
 
Back
Top