XSLT
Future-proof XHTML/XML Markup
Tue, 2007-07-03 23:54 — iDonnyThose of us that wrote markup for websites more that four (4) years ago are aware of the situation where markup styles and standards become obsolete. Whether or not this could have been prevented by coding markup differently is a question I have had to ask myself when confronted with having to rewrite and improve upon code and website markup that has proven to be buggy, redundant, and far from the contemporary coding and XHTML markup standards
XML provides the promise and possibility of writing markup that can fit and be compatible with the coding and software standards of the future. XML by its definition is extensible and virtually unlimited in possibilities. Being that XML data can be parsed based on a DTD, and transformed using XSLT into virtually and data presentation format or proprietary format.
Conclusion
Data representation in XML enables you to transform it based on the markup standards of today, as well as those of the future.
XHTML from XML using XSLT: Platform independent end-to-end enterprise information availability
Data manipulation in XML and Dynamic transformation into XHTML using XSLT
It is no-longer enough to just have a good-looking website that is regularly updated, or even running on a proprietary CMS application as a data island. Interconnectivity with other systems, as well as the ability to mix and match technology and software applications from various vendors without compromising the seamless exchange of information is the cornerstone of an agile and fluid information architecture. XML makes this representation and exchange of information possible by being plateform independent, based on pure text characters (ASCII), and virtually infinitely transformable to and from other data formats and technologies.
In the wider application of this concept is the position of a website as an extension of the organisation (with reasonable security controls and limitations) with real-time access to back-office information and availability of functions to avail services and information to users around-the-clock.
This document is an overview of the narrow function of XSL/XSLT in transforming XML (data) to XHTML (representational mark-up) for consumption by web media. Although the transformation of data stored in a relational database to website content has been done with impressive efficiency and speed, this method is still plagued by the limitation of proprietary technologies. For instance, the use of a MYSQL database limits one to using the PHP application server (unless the right adapters are in place to enable theus of other non-native server-side technologies such as JSP, ASP etc). By adding a layer that translates all information from any relational database to XML, it is possible to use any XML compatible server-side technology to handle and exchange information irrespective of the DBMS in use.
The above reality makes it important to consider how to transform XML information to XHTML that can be presented the the end user at the end of this XML free-for-all.
XSL/XSLT makes it possible to generally or conditionally transform XML information to any other XML based format.
In the example below, we are using XSLT to write an XHTML document and dynamically pulling in XML information and adding XHTML mark-up as well as CSS styling information in an external CSS file. It generates an XHTML table for each item in a collection of books and adds mark-up to the XHTML for styling using a linked CSS file.
<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" xhref="idonnystyle.css" />
</head>
<body>
<h2>iDonny XSLT Demonstration</h2>
<table id="main_table">
<tr class="header_title">
<th class="column_1">Title</th>
<th class="column_2">Artist</th>
</tr>
<xsl:for-each select="catalog/books">
<tr>
<td class="column_1_data"><xsl:value-of select="title"/></td>
<td class="column_2_data"><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template></xsl:stylesheet>


