Variables Used in Book Source Files

This section describes variables used in book source files.

Variable Definitions and Replacements

Variables are special logics used by hyPub to assign text values in place and apply them in other places in the book source file.

There are 3 categories of variables used in hyPub:

Defining Variables

In book source files, variables are defined using the following syntax:

<p class="variable" id="variableName">variableValue</p>

where "variableName" is the name of the variable, and "variableValue" is the value of the variable.

Do not use underscore characters "_" in variable names.

A variable definition must be done in a single text line. Currently, hyPub is not smart enough to parse multiple lines for variable definitions.

Recursive definitions of variables are not allowed.

The scope of a variable is limited to the container where it is defined.

If the same variable name is defined multiple times in the same container, the last definition wins.

Applying Variables

In book source files, variables can be applied (evaluated to their values) anywhere in the book source file using the following syntax:


where "variableName" is the name of the variable.

When an undefined variable is used in the book source file, hyPub will not give you compilation errors. It will simply ignore it.

When a variable is defined multiple nested levels, the definition of inner level wins.

hyPub Built-in Variables

Currently, hyPub supports 4 built-in variables:

Required Variables

Currently, hyPub requires the following variables:

Optional Variables

hyPub allows you to define your own variables in book source file, and apply them any where you want. For example, you may define some variables listed below:

<p class="variable" id="pi">3.141592653589793</p>
<p class="variable" id="myDomain"></p>

Table of Contents

 About This Book

 Ideas on Publishing Books using XML

 Overview of hyPub - A Simple XML Publishing Tool

Writing Book Contents in XHTML Source Files

 Book Source File Structure

Variables Used in Book Source Files

 Inserting Anchors in Book Source Files

 Transforming Book Source Files with XSL Technology

 Designing Web Page Layouts with Tables

 Controlling Web Page Appearance with CSS

 Sharing HTML Codes with JavaScript Files

 Generating Web Pages with hyPub

 Formatting Printable Documents with XSL-FO

 Generating PDF Documents with hyPub

 Areas of Future Improvements


 Full Version in PDF/ePUB