My program generates HTML via stringbuilder.
sbHTMLHeader.Append("<div id=\"printableContent\">");
sbHTMLHeader.Append("<div id=\"packingSlipHeader\">");
sbHTMLHeader.Append("<div class=\"floatLeft\"><img src=\"../images/logo.gif\" alt=\"Logo\" /></div>");
//...
if (!orderType.Equals("L"))
{
sbHTMLHeader.Append(" <td>" + orderData.Tables[0].Rows[0]["carrier"] + "</td>" + Environment.NewLine);
//...
}
else
{
sbHTMLHeader.Append(" <td></td>" + Environment.NewLine);
//...
}
//...
380 lines later, I am passionitely against this code. In the past, I used Altova Stylevision. At my current job we have no license for the product. I don’t need any of the PDF or other templates it provides, just HTML. Can you suggest a powerful, readable alternative to generate HTML such as above?
An alternative would be to store all the data in an XML file and write an XSLT (transformation sheet) that turns it into HTML.