Individual Panels XML Document Design

page 177 If this were a Java program, we might create a main method that looks like this: public static void mainString[] argv { buildMainIndex; buildSectionIndexes; buildIndividualPanels; generateGraphics; generatePDFFileletter; generatePDFFilea4; generateZipFile; } This style of coding facilitates maintenance; if the PDF files arent generated correctly, the templates with mode=generate-pdf-file are the obvious place to start debugging. In addition, we structured the files so that all the templates for a given mode are in a single file that can be included into our main stylesheet: xsl:include href=toot-o-matic-variables.xsl xsl:include href=xslt-utilities.xsl xsl:include href=dw-style.xsl xsl:include href=build-main-index.xsl xsl:include href=build-section-indexes.xsl xsl:include href=build-individual-panels.xsl xsl:include href=build-graphics.xsl xsl:include href=build-pdf-file.xsl xsl:include href=build-zip-file.xsl In addition to the obviously named files, the file toot-o-matic-variables.xsl defines several global variables used throughout the stylesheets, xslt-utilities.xsl is a library of generic routines substring replacement, for example we use, and dw-style.xsl defines the look and feel of our HTML pages.

9.5.2 Initializing Global Variables

Its worth discussing the global variables initialized in toot-o-matic-variables.xsl. All of these variables are used throughout our various stylesheets, and initializing them saves us a significant amount of processing time. The most significant variable is mouse-effects . This variable is an automatically generated segment of JavaScript code used to process mouseover effects on all the HTML pages we generate. Heres how the generated code looks: -- var emailAbstract=developerWorks is proud to present the Toot-O-Matic,...; var justTitle=Building tutorials with the Toot-O-Matic; var tutorialPrereqs=http:www-4.ibm.comeducationtootomatic; var menu1blurb=Installing and configuring Toot-O-Matic; var menu2blurb=Creating your first tutorial; var menu3blurb=developerWorks editorial guidelines; var menu4blurb=Toot-O-Matic tag guide; var menu5blurb=Toot-O-Matic tag reference; var menu6blurb=Troubleshooting; var menu7blurb=Feedback; var browser = x; if navigator.userAgent.indexOfMozilla4 = -1 browser = N3; else if navigator.userAgent.indexOfMozilla3 = -1 browser = N3; else browser = x; if browser==N3 { var menu1over=new Image108,68; var menu1out=new Image108,68; var menu2over=new Image108,68; var menu2out=new Image108,68; var menu3over=new Image108,68; var menu3out=new Image108,68; ...