| ||
| Nun.Me.Shu - concepts |
Basic concepts of the Nun.Me.Shu architecture.
Separation of logic, content and presentation
Building a web site using XML and XSL allows for a clean separation between business logic, content and presentation:A different, more detailed version of the previous figure, which applies to the Nun.Me.Shu framework, is shown below: Explanation of the above figure: Static web page content in the Nun.Me.Shu framework is stored in XML files. Templates for transformation and layout are stored as XSL files. XSL files need to include site-wide content: the information for navigation, header and footer is stored as an XML file; small text fragments are stored in an ENT file. Two other ENT files store specific environment information (mainly URLs) and layout information respectively. An XSLT processor uses the information in the XSL files to transform the XML files into HTML. The HTML file references GIF or JPG images, JavaScript JS files and Cascading Stylesheet CSS files that are used by a browser to display a web page on a user's computer screen. Modular XSL stylesheet
The "XSL stylesheet" is modular for understandability and expandability, and consists of the following files:- main.xsl [view sample] |- common.xsl (global variable definitions and common templates, shared by the other stylesheets) |- debug.xsl [view sample] |- amazon.xsl [view sample] |- moreover.xsl (common templates, but specific to moreover's web service) |- yahoo.xsl (common templates, but specific to yahoo's service) |o yahoo.xml (content for yahoo directions form) |- pagelayout.xsl (pagelayout for the html page) |o wrapper.xml [view sample] |- wrapper.xsl (templates for the wrapper components of a page) |- (sp_content.xsl) (site-specific templates for the content component of a page) |- (sp_wrapper.xsl) (site-specific templates for the wrapper components of a page) |0 defs_env.ent [view sample] |0 defs_layout.ent [view sample] |0 defs_content.ent [view sample] This modular design is based on server-side page rendering. The resulting stylesheet contains all available templates, and is thus relatively large (110K - including lots of comments). Server-side this stylesheet is compiled and kept in memory; size is not so much an issue, and is compensated by the benefit of having just one stylesheet for all web pages. In case of client-side rendering, the single stylesheet is probably too big. In that case it could be modularized even more (split common.xsl in separate files for each functional section, -paragraphs, links, graphics, lists, forms-), and each page could have a trimmed down version of the complete stylesheet. This requires more effort in defining the right stylesheet for each page, but leads to less data transfer to the client. (I'm still on a 56K modem, despite my Internet development work, so I assume that still as the standard.) Note that the stylesheet has build-in debug templates, to flag unmatched elements in the XML files and to allow for run-time display of debug information. The stylesheet has build-in templates to process pre-styled (X)HTML components. This allows for an architecture in which some of the components of a page that are fairly static are pre-styled and cached as (X)HTML, so that the stylesheet can simply copy them. Any URL or environment-specific identifier is defined in the defs_env.ent Entity Definition file, which is referenced in the main stylesheet. In a promotion process (development -> QA -> production), only this one file might have to be changed. My own development environment reflects my ISP's hosting environment; consequently I do not have to change anything when promoting files from my personal development environment to my ISP's hosting environment. There are no hard-coded URLs in the stylesheet. Therefore, if at some point in the future the directory structure of the site would change, only the defs_env.ent file has to be updated accordingly. General purpose XML
The XML elements to describe the content are kept as general as possible [view sample DTD]Where ever possible, elements are re-used. For instance, there is a <graphic> element to describe graphics and images. There also is a <graphiclist> element which can be used for instance to create photo-album pages. This <graphiclist> element has the generic <graphic> element as a child. This provides consistency for a content editor, and keeps the amount of templates in the XSL stylesheet to a minimum.
A very good startpoint for XML/XSL design is the DocBook
<mediaobject> <imageobject> <imagedata fileref=".." width=".." depth=".." format=".."/> </imageobject> </mediaobject> Note the depth attribute to specify the height of the image. In the Nun.Me.Shu architecture I have used several of the concepts and ideas behind DocBook, but I simplified it and adapted the DTD to be specific (and limited) to a web page and its content. "Zen"-like approach to web design
The Nun.Me.Shu framework supports a "Zen"-like approach to web design:
|
This page, and all contents, is Copyright © 2002-
Edward Maesen, San Francisco, CA, USA.
|
Dashed arrows indicate data inclusion.
Two-way arrows indicate a repetitive pipeline process: output can be used as input for a similar step.