|
||
| Inside Technique : Building Documents with XML, XSL, and CSS : Presenting the XML You have seen how you can author a simple document in XML. By itself the document has no real presentation. To add presentation to your XML document you can either define a style sheet using CSS or transform the document into a new document using XSL. We have chosen to use XSL to transform the document over using just CSS for a couple of reasons. We are not using CSS as it does not allow processing or manipulation of the page. CSS essentially provides control over rendering of an already structured document. We want our presentation to specify the keywords within an HTML meta tag, a table of contents with links to each section, and pull-quotes where certain content is duplicated in the margin. All of these are currently well-beyond the capabilities of CSS. All of these manipulate content outside of the document's XML structure. More importantly, XML by itself is a raw format. We are using XSL as a way of separating the ultimate presentation of the document from the raw file. By doing so, we can start solving the multiple presentation issues that will face us in the future. Today, web authors gripe about how to properly present documents to be displayed on different browsers. The focus is currently on incompatibilities that exist between the browser. In the future, even if we all have completely standards-based and compatible browsers, this problem will not go away. It will have simply evolved into a cross-medium issue rather than a cross-browser issue. I can assure you that the way you view a document on your computer will be different from the view you want to see on your PDA, phone, and even the television (many colors bleed badly on TV). How are you going to solve this? XSL is key in that you can create different transformations for different mediums. Now imagine that each browser you want to target is a different medium. You can create transformations of your document that generate an HTML 3.2 version, a HTML 4.0 with CSS version (with maybe a Netscape specific and IE specific version), and possibly a version formatted for a target audience (eg., color blind, etc.). The number of mediums you want to target is entirely up to you and limited only by your ability to generate new XSL templates, rather than multiple instances of your content. Furthermore, since the template is separated completely from your content, updating the content automatically updates every medium's view of the content. This is a future goal of SiteExperts.com. We want to rebuild our backend document management system to intelligently transform documents based on the medium. This will make our system much more flexible and maintainable. We will be able to change the entire site's look at feel completely independent from the articles as well as change the processing of the actual content and have it automatically managed by the system. Next we are going to look at how we used XSL to transform our document for viewing on Internet Explorer 5.0. The demonstrations are limited to IE5 as we use IE5 to process and render the XML and XSL files. In a future article we will explore server-based techniques for providing multiple views on a single document for viewing on different mediums and browsers. By moving processing to the server, the client viewer does not need to know nor does it care that the backend data is in XML. Page 1:Building Documents with XML, XSL, and CSS © 1997-2000 InsideDHTML.com, LLC. All rights reserved. |