ScreenBook Maker : Advanced    Customizing Screenbooks  

Page 1


You've learned in a previous tutorial that the master file for a screenbook is a file named sbook.xml in the screenbook folder. All of the HTML files for a screenbook are created from this master file.

The process goes likes this:

When you click on the Finish button when editing a screenbook, Screenbook Maker saves the text of the screenbook, and links to the PNG files, into sbook.xml.

Screenbook Maker then looks in the bookshelf file for files beginning with sbx_ and ending with .xsl. These files are XSLT files. XSLT is a language that contains instructions for transforming XML (like the contents of sbooks.xml) into HTML or another format.

For each and every XSLT file that Screenbook Maker finds in the given bookshelf, Screenbook Maker transforms sbook.xml and stores the resulting output in a file with the same name as the XSLT file, but without the sbx_ prefix, and the .xsl suffix. If there is no other suffix in the resulting file name, Screenbook Maker adds the suffix .htm.





Page 2


Let's look at an example. Here we are looking at a Screenbook Bookshelf in Windows Explorer. You can see that the folder contains a file named sbx_sbook.xsl. Therefore, in every screenbook folder of this bookshelf, there should be a file named sbook.htm.

  Click on the image for page view.




Page 3


Sure enough, here is the sbook.htm file in one of the screenbook folders.

  Click on the image for page view.




Page 4


Here we've double-clicked on the sbook.htm file, and you can see that this is the file that has the Page View version of the screenbook.

  Click on the image for page view.




Page 5


Let's take another look at the screenbook folder. You can see there are a bunch of files named slide01, slide02, etc. How did these files get created? Surely we don't need an XSLT file for each one!

  Click on the image for page view.




Page 6


Here we are looking at the bookshelf again. You can see that there is no sbx_slide01.xsl file. However, there is a file named sbx_slide.xsl . This file contains an instruction to create a file for each page element of sbooks.xml. We'll demonstrate how this special instruction works later.

  Click on the image for page view.




Page 7


You can completely customize the output of Screenbook Maker by changing the XSLT files, or adding new ones.

XSLT is a powerful language, and you can create virtually any kind of output you want. Screenbook Maker may in the future also come with a WYSIWIG tool for customizing output, but it will simply never be possible to create a tool that will approach the power of directly editing the XSLT.

But does this limit customization to programmers who know XSLT? Not at all. Screenbook Maker comes with a number of default XSLT stylesheets that you can edit. You don't need to know XSLT to start editing these stylesheets. You only need to know HTML. Edit the HTML portions of the XSLT stylesheets, and use the xsl elements as prefabricated pieces.





Page 8


Furthermore, editing the XSLT is made even easier by the fact that Screenbook Maker works in conjuction with a breakthrough programming tool called Leo. Leo is a Literate Programming Editor that allows you to view the XSLT code in an easy-to-read outline form. You can quickly find the parts you want to edit and ignore the rest of the code.

Not only does Leo allow you to view the code of an individual file in outline form, it also can contain numerous files inside of one outline. All of the default XSLT files that come with Screenbook Maker are contained in one single Leo file, and can be viewed and edited within Leo.





Page 9


In order to try out customizing the XSLT for a bookshelf, first make a new bookshelf with a couple of test screenbooks. In this screenshot, we've made a test bookshelf called Sample.

  Click on the image for page view.




Page 10


Next, choose Advanced - Edit Files - Edit Stylesheets.

  Click on the image for page view.




Page 11


A Leo window opens. (If Leo is not installed on your machine, instructions for installing it will appear here. Leo is a free program written by Edward K. Ream and available on www.sourceforge.net).

  Click on the image for page view.




Page 12


All of the XSLT files for the bookshelf are contained in this Leo file, along with information about what each file does and how to edit the files.

Here we've clicked on the node About Screenbook Maker XSLT files. The node has opened, showing several child nodes.

  Click on the image for page view.




Page 13


Here we've clicked on an element (1) and the text for the element (2) is showing. As you can see, this Leo file includes the same information contained in the tutorial you are reading now.

  Click on the image for page view.




Page 14


Now we've closed the About Screenbook Maker XSLT files node, and opened the XSLT for sbook.xml node. This node contains the actual XSLT files that are used for transforming sbook.xml. If you will recall, sbook.xml is the master file that Screenbook Maker uses for creating screenbooks, so these are the files that will generate the HTML output.

  Click on the image for page view.




Page 15


Here we've opened all of the nodes for the sbx_sbooks.xsl XSLT file. You'll recall from an earlier tutorial that this XSLT file is the one used for creating the page view screenbook. The << head >> element is highlighted, so the code for this is showing in the code window below.

  Click on the image for page view.




Page 16


Here we've enlarged the code window to show the  head  element. If you know HTML, this should look familiar. In fact, it is simply HTML. The only new thing is the highlighted <xsl:value-of> elements.

If you look carefully at the xsl:value-of elements, you can see that they are simply placeholders for the topic title and the screenbook title.

  Click on the image for page view.




Page 17


Now, let's look at the body element. This has three subsections.

  Click on the image for page view.




Page 18


Here we've clicked on the layer 1 element. The code window has a comment explaining that this code is for the document navigation bar (the line of small icons in the standard screenbook format).

  Click on the image for page view.




Page 19


Here we've edited the XSLT - we've deleted most of the navbar and added the test "YOUR AD HERE".

  Click on the image for page view.




Page 20


Now Save the Leo file (or type Ctrl-S). Saving the Leo file causes the sbx_sbook.xsl file to be extracted from the Leo file and written to the bookshelf folder.

  Click on the image for page view.




Page 21


Here we've returned to Screenbook Maker and are viewing the file sbook.htm (by clicking on the Page View icon). However, no changes are showing to our file, because we have only changed the XSLT. We haven't told Screenbook Maker to regenerate the HTML files.

  Click on the image for page view.




Page 22


Screenbook Maker will automatically regenerate the HTML if we edit the screenbook. Or, we can click on Regenerate HTML from the screenbook popup menu.

  Click on the image for page view.




Page 23


The new version of our page appears.

  Click on the image for page view.




Page 24


Each bookshelf contains a file name sbx_sbooksimple.xsl. This is a very simple XSLT stylesheet. If you find editing the other XSLT files to be complicated, you may want to experiment with this file first. The output from this file is sbooksimple.htm.

  Click on the image for page view.



Text Author: Joe Orr