2 ms·
Long ago I learned that system source code is not as important as data. You can always hire hot-shot software developers to (partially machine-)translate the sy
by thangalin 14y ago
Long ago I learned that system source code is not as important as data. You can always hire hot-shot software developers to (partially machine-)translate the system into the langue du jour.
Using XML allows means the data associated with every "page" in the system automatically doubles as a service (SaaS). XSLT allows those those services to be translated into JSON, ASCII, PDF (via LaTeX), XML, or the format du jour. With this architecture, the amount of time to publish a new export format for every "page" in the system is reduced to the time it takes to write a new XSL template: hours to a few days.
All pages can reuse the same code to render themselves:
$data = get_xml( $id );
$xml = get_xml_dom( $data );
$xsl = get_xsl_dom( $stylesheet );
$proc = get_xslt_processor( $id, xsl );
echo $proc->transformToXML( $xml );
This cleanly separates business logic and the data model from presentation, plus much more. Perhaps it is masochism, though. ;-)
- astrodust 14y agoI'd prefer to pick a language for the job that can handle manipulating the data as well as emitting it in the correct format. Having to duct-tape XSLT on top of PHP just because PHP can't cut it is rather perverse. The only thing I can think of that's worse than "programming" in XSLT is ColdFusion.
- thangalin 14y agoWhat language can make every page output XML, PDF, JSON, or ASCII, without changing the business logic, data model, or spending more than a few hours developing each new format?