So far, we have examined how AxKit can be used to transform static XML documents. Transforming such documents via XSLT stylesheets or another means that can alter, create, or include content conditionally provides a certain level of dynamism , but most modern web sites include features or resources that need to change for each unique request. An altered version of a static source is not enough, the source itself must be generated programatically.
By now, you are surely aware of the value of separating content from presentation, and how that value increases when the documents being served are marked up using semantically rich grammar that intimately captures (or communicates) the meaning of the information they contain. The same principle holds true when creating XML-based applicationsthe key difference is that markup generated in an application context should attempt to most accurately reflect the structure and roles of the resources associated with (or required by) the current state of the application, rather than those of a static narrative document.
By generating only the data relevant to the current state of the application, developers working on the backend libraries have simpler and better defined targets to hit. Since the markup being generated does not include any presentational elements, the grammar for the document being produced is usually greatly simplified. Among other things, this means that the generated content can be evaluated in detail using nothing more than a validating XML parser and a Document Type Definition (for instance, one of the XML schema languages) to verify the result. Hence, acceptance testing can become fully deterministicthe coder knows her job is done when the generated grammar passes a validity test, not when it seems to render correctly in one or another client application.
Similarly, having a simplified, well-defined application grammar offers stylesheet authors the ability to develop and test their stylesheets using sample documents that accurately reflect the data that will be generated when the application goes into production. This means that application development can push ahead asynchronouslythe stylesheets that will render the application content can be completed at the same time (or even before) the code that generates the content is written.
Also having the ability to reuse the same content to meet the needs and expectations of a variety of clients is a key benefit of an XML application environment. Being able to deliver the same essay as either HTML or PDF is a cool feature; being able to offer the same online application to a variety of clients can directly affect the profitability of a web-based enterprise.
In short, the benefits of separating content from interface are especially noticeable when the markup in question is being generated dynamically in the context of an online application. In this chapter, I introduce a few of the tools and techniques that AxKit offers for creating content dynamically and explain how applying transformative styles to that generated content can be used to create flexible, sophisticated online applications.