DynaWeb Publishers Guide
|2. Publishing DynaText Books Using DynaWeb|
|How DynaWeb Uses the dynaweb.wv Stylesheet|
Once you've mapped each style to its HTML equivalents, DynaWeb uses the text-before and text-after properties of the style to insert HTML tags before and after each element instance.
Note: The following examples are presented as they would appear when using a text editor to edit your stylesheet.
To illustrate, suppose there is a "Note" style in your DTD that automatically generates the text "Note: " at the start of an element. The style definition of the "Note" style would look like this:
<style name="NOTE"> <text-before> Note: </> </style>
The text-before property of the "Note" style turns this tagged line:
<note>Be careful of thin ice!</note>
into this output:
Note: Be careful of thin ice!
In the dynaweb.wv stylesheet, we need to decide how we want to display the "Note" style using HTML. In this case, we'll just use a standard paragraph tag. Using the text-before and text-after properties, we can insert the tags the browser needs in order to display the "Note" style properly. The "Note" style in the dynaweb.wv stylesheet now looks like:
<style name="NOTE"> <text-before> <p>Note: </> </style>
If we were to display the element again in InStEd using the dynaweb.wv stylesheet, we would now see this output:
<p>Note: Be careful of thin ice!
Notice that the text output of the "Note" style now looks like valid HTML.
Property value functions are built-in functions provided by DynaText that can be used in stylesheets. DynaWeb recognizes and evaluates all of the property value functions used in its stylesheets. Any DynaText style that uses property value functions in text-before or text-after properties should not use the style groups provided in the htmlgrps.v stylesheet. If you do use the style groups, you will overwrite the PVF contained in the style. You must explicitly set the text-before and text-after properties inside the style in order to retain the property-value function.
Further Information: "Appendix B: Property Value Functions," Publishing: Document Preparation.
When specifying text-after strings in particular, adding the closing HTML tag can be confusing. DynaWeb provides two PVFs of its own to aid in the mapping of SGML styles to HTML tags. Style attributes are closed with the following tag:
However, only the first two characters of the tag are important to the stylesheet parser. As a result, if we try to end an HTML tag normally in the text-after property, it would look like this:
<text-after> </p> </>
As soon as the stylesheet parser sees the left-angle (<) followed by the slash (/) character, it ends the style (in this case, prematurely). The above line ends up being read like this:
and we lose the text-after content. Previously, this was avoided by using the join() PVF in the text-after property.
<text-after> join('<','/p>') </>
By delaying the evaluation of the ending tag until the text-after property was ended properly, the problem was avoided. Now, instead of typing in the entire join() PVF, you can simply type endtag() and specify the tag you are ending inside the parentheses, as follows:
<text-after> endtag(p) </>
This generates the following output in the text-after property:
Although it is not necessary to use it, the starttag() PVF is provided for symmetry and shares the same syntax as the endtag() PVF.