Modest

Due to differences in Web browsers in their support of XML, it is not feasible at this point to expect XML/XSL files to be rendered suitably as HTML pages by the client browser. The XML/XSL processing must be done on the Web server that subsequently returns HTML pages to the browser. However, specific Web servers may not be set up to efficiently process XML/XSL files or particular organizations may not have time to configure Web servers properly. Still, this does not mean that those organizations cannot use XML/XSL nor benefit from its advantages.

Outlined below is a modest approach that shows how to create and maintain source files as XML, process them into the required HTML Web pages using XSL, and then save those individual Web pages as HTML files that can be uploaded to a Web server. This does not change a HTML-based Web server environment, but it does enable maintenance of those files more efficiently through XML/XSL.

The Moderate example in the Getting Started section of this Web site provides simple files for implementing this approach, so refer back to those files while following the steps below.


Step-by-Step Instructions
  1. Create a Source XML file using an XML text editor such as XMLSpy or <oXygen/> or any other text editor or HTML editor. An XML editor is recommended because they have additional features and functions that make creating and maintaining XML/XSL files easier. But many HTML editors are now offering XML editiing capabilities as well.

  2. Create the XSL file to transform the XML source file into the HTML pages.

  3. View the HTML Web page generated by the XML/XSL either through the XML editor (both XMLSpy and <oXygen/> have capabilities to generate the transformed HTML and view it) or via a desktop browser (if the client browser is configured to process XML).

  4. Save the source HTML code from the generated HTML Web page as a ".html" file and upload it to the Web server.

Mujtliple HTML Web Pages created by XML/XSL

Using the step-by-step approach above, one XML source file and one XSL transformation file can be used to generate several HTML Web pages. In the Moderate example from the Getting Started section of this Web site, the source XML file holds all the text for the About Us section of the Web site. One XSL file transforms the XML file into multiple HTML pages simply by changing the chapter label attribute to match individual chapters in the XML file.


Looking at the Sample Files

As mentioned above, the sample files from the Moderate example in the Getting Started section of this Web site can be used to try out this approach. Highlighted below are the parts of those sample files that pertain to the example here.

Notice how each "<chapter>" element in the XML file contains a "label" attribute that identifies the content of that chapter (mission, glance, partners, directions). These chapters will become the individual HTML pages produced by the XSL, but here they can be maintained in one source file.


<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="moderate_xml.xsl"?>
<book label="CTG">
 <title>About Us</title>
<!-- **************** MISSION ******************************************-->
  <chapter label="mission">
   <title>Mission</title>
  .  .  .  .  .  .
  </chapter>
<!-- **************** AT-A-GLANCE ******************************************-->
 <chapter label="glance">
	<title>At-A-Glance</title>
	 .  .  .  .  .  .
 </chapter>
<!-- **************** PARTNERS ******************************************-->
 <chapter label="partners">
	<title>Partners</title>
	 .  .  .  .  .  .
 </chapter>
<!-- **************** DIRECTIONS ******************************************-->
 <chapter label="directions">
	 <title>Directions</title>
	 .  .  .  .  .  .
 </chapter>
</book>

The XSL file will use a parameter (called "param name='sub'") defined in the fourth line of the example file to select the individual chapters from the XML file based on their label attribute. The sample portion shown here defines the parameter as "mission" which will select only the mission chapter from the XML file. Once the HTML file is produced and saved, the parameter can be changed to the other chapter labels ("glance," "partners," and "directions") to produce the HTML files for those pages.


<?xml version="1.0" encoding="UTF-8"?>      
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Declare parameters that identifies which chapter to select from xml file -->
<xsl:param name="sub">mission</xsl:param>

			

The result would be four HTML pages from the original source XML file>

Moderate HTML Web Page created by XML/XSL