Setting up a Publishing Style Sheet
You can have any number of Publishing Style Sheets in your database. For example, you might have one to publish a catalogue; another to produce a price list; another to create a telephone directory; and so on.
First, a little discussion about the logic of how a Publishing Style Sheet works. Every publishing project can be broken down into paragraphs. There might be just one paragraph of information for each item (as in a simple telephone directory), or there might be a number of paragraphs (as in a catalogue). Each Publishing Style Sheet is constructed by adding Paragraphs in the order in which they will be published.
Each Paragraph can consist of any number of Elements. An element can contain:
- Data from a field in the database
- Static text (such as the word "Tel:" inserted before a telephone number
- A Formula. Tell CatBase how to make intelligent decisions about what data to include (or leave out) and/or how to format it
- Punctuation (such as a Tab character)
- A Calculation - for example, to mark up or discount prices
- A Picture
- A Relation: include data from a related table
Creating a Publishing Style Sheet
- On the main window, click on the Style Sheets button and choose Publishing Style Sheets from the pop-up menu.
- In the Search Dialogue Window, click on the Create a New Record button.
- A new Publishing Style Sheet is created:
- Enter a name for the PSS in the Publishing Style Sheet Name field.
- From the Base Table pop-up menu, s elect the table on which this publication will be based. In the example shown here (which is from our Demo Database), the Photographers table is selected: we are going to publish a telephone directory listing our Photographers.
- From the Default Publishing Destination pop-up menu, select the publishing destination that you are most likely to use for this publication. It shows the default publishing destination that has been selected for the database: this can be changed in System Preferences (choose System Preferences from the Admin menu on the main window).
- Click on the Prefs tab. There are a number of options on this page: for now, we are only concerned with the Sort Order. Either select a Sort Order from the pop-up menu, or click on the New Sort Format button to create a new Sort Order. Sorts are described in more detail in the Sorting Data Tutorial.
- Click on the Paragraphs tab.
- Now let's think about how our telephone directory is going to look. We have offered our photographers the choice of being listed in several different ways:
- A Basic plain listing: name and phone number
- A Bold listing: name and phone number set in bold
- An Extended listing, which includes additional details such as their specialty
- A Boxed listing: Additional details, set in a box with a plain border
- So we will need to set up a Paragraph to handle each of these options. We'll start with the simplest one: a Basic listing.
- Click on the Add a Paragraph button to crete a new Paragraph
- A new Paragraph looks like this:
- There are two important things on this page: Style Sheet Name and the Elements area.
The Style Sheet is what will determine the basic formatting for the Paragraph, and the Elements area will determine what's going to go into the Paragraph.
- Choose a style sheet from the Style Sheet Name popup menu.
Style Sheets are exactly the same as the style sheets that you use in your page layout program. Click on the New Stylesheet button if you want to create a new style sheet.
- What are we going to put into this Paragraph?
- The photographer's name
- A Tab character
- Their phone number
At first glance that looks like three Elements. But the name is actually made up of three elements: First Name, a space, Last Name. So we will have five Elements in this Paragraph.
- Click on the Add an Element button. The Element page looks like this:
- The first Element we need is the photographer's first name, which can be found in the field called First Name. The Field radio button is already selected, so just click on the pop-up menu next to the Field radio button and choose First Name.
- Click on the Save button (the check mark in the button box at the bottom right of the window) or press the Enter key to save the element.
- The Elements area on the Paragraph window should now look like this:
- Click on the Add an Element button again
- In the Element window, select the Text radio button
- The cursor should now be flashing in the text editing area next to the Text radio button. Type a space and then save the Element.
- Add another Element, select the field, Last Name, and save it.
- Add another Element and this time select the Punctuation radio button. Tab is selected by default, and this is what we want, so just save the Element.
- Add another Element, select the field Telephone, and save the Element.
- Your Paragraph should now contain five Elements:
- If yours are not in the correct order, you can drag a row up or down to reorder them.
- At this point you may be wondering: How does CatBase know which records to format in this Basic style, rather than one of the other optional styles? We need to tell it how to make that decision, and that's done via a Formula.
- Add another new element and select the Formula radio button. A Formula looks like this:

- Formulas are based on the construction "IF something is true, THEN do one thing; OTHERWISE, do something else". In this example, we want to say "IF the Listing Level is 'Basic' THEN include this Paragraph, OTHERWISE don't include this Paragraph".
- In the IF area, choose the field Listing Level from the pop-up menu.
- Notice that the display changes a little: the text entry area in the IF area disappears and is replaced by another pop-up menu. This pop-up lists the choices that are available for the Listing Level field (the Listing Level field has been designated as a Choice List field with a choice list called Listing Level attached to it).
- In the second pop-up menu, next to the field pop-up, choose "Equals".
- In the choice list pop-up menu, Basic should be selected by default, as it;s the first item in the list. Your list may be different, if somebody has been experimenting with the database; in that event, choose Basic or some other option.
- In the THEN area, select the Include This Paragraph radio button.
- Your formula should now look like this:
- Save the Formula, and save the Element.
- Your Paragraph now contains six Elements. Drag the Formula Element to the top of the list so that it appears in the first position - this will save on processing time when you publish the data, as the program won't process the other Elements if it does not need to include this Paragraph.
- Click on the green check mark to save the Paragraph.
Elements are described in detail in the Reference Manual, Chapter Six, which you can download from here.
What if the photographer has paid for a Bold listing? We need to set up another Paragraph to tell CatBase how to handle that option.
- In the main Publishing Style Sheet window (with the list of Paragraphs displayed), click on the Add a Paragraph button.
- Choose a different Stylesheet for this Paragraph; in the Demo database we've got one called Directory Entry Bold.
- Repeat steps 18 to 45, above, but this time in the Formula choose Bold in the Listing Level choice list.
Now you know the basics of creating a Publishing Style Sheet. There are lots of additional options for selecting and formatting the data - please see other Tutorials and the Reference Manual for more details (download Chapter Six here).
What's Next?