baavgai: (Default)
( Oct. 27th, 2005 11:11 pm)
XML is ubiquitous. Companies even brag about using the stuff. At its introduction it came with a neat language called XSLT. The language is ideally suited to taking XML making it into HTML, the language of web pages. And yet, where is it?

A few years ago I worked on an open source project. XSLT seemed an ideal solution and yet no one was competent to use it. They ended using PHP for generating static content. Ack.

Today, I'm moving an ASP app to a WinForms one. I realize I want to display some output in a browser, but without a web server. Without the 800lb gorilla of ASP, I decide generate data as XML and apply XSL transformations to it. Damn, this is easy.

Messy code like this:
writer.Write("<span class=\"thumb\">");
writer.Write("<a href=\"" + fullPath + "\">");
writer.Write("<img");
writer.Write(" src=\"" + fullPath + "\"");
writer.Write(" alt=\"" + fileName + "\"");
writer.Write(" />");
writer.Write("</a>");
writer.Write("<span class=\"check\"><input name=\"" + filePrefix + fileUid + "\" type=\"checkbox\" checked=\"checked\" /></span>");
writer.Write("</span>\n");


Becomes this:
<span class="thumb">
<a href="{fullPath}">
<img src="{fullPath}" alt="{fileName}" />
</a>
<span class="check">
<input name="{filePrefix}{fileUid}" type="checkbox" checked="checked" />
</span>
</span>


And yet, you rarely see XSLT in the wild. I don't get it.
.

Profile

baavgai: (Default)
baavgai

Links

Most Popular Tags

Page Summary

Powered by Dreamwidth Studios

Style Credit

Expand Cut Tags

No cut tags