P1: IML
Cassel WL040/Bidgoli-Vol III-Ch-65 September 15, 2003 8:52 Char Count= 0
WIRELESSMARKUPLANGUAGE 811Figure 8: Navigation button.that button displays the first card in the deck, the one
labeled Start. This device also has a button permanently
labeled Bck, which corresponds to the Prev event in WML.
Pressing that button backs up the display to the previous
card, popping the history stack. The button to the right,
just below the screen corresponds to the reset event in
WML, and the options event. The Clr button corresponds
to the delete event. Each of these buttons can be controlled
by the WML code by substituting the correct event name
foracceptin the code example above. Substituting “re-
set” for “accept” in the code above will move the Restart
label to the right button and pressing the right button will
take the display back to the first card in the deck.Variables
WML specifications describe content and navigation, not
processing. However, there are occasions when the ability
to store a value in a variable allows flexibility needed in
the application. Variable names are case-sensitive, begin
with a letter or underscore, and continue with 0 or more
letters, numbers, or underscores. The variable reference
syntax is specified using the extended Backus–Naur form
used in XML as follows:varref :: = ("$" varname) |("$(" varname
(conv)? ")")
varname :: = ("_" |alpha) ("_" |alpha|
digit)*
conv :: = ":" ("escape"| "noesc"| "unesc")
alpha :: = [a-zA-Z]
digit :: = [0--9]Parentheses may be used for clarity and are required
where it is not otherwise clear where the variable name
ends. Both$(var)and$varare legal references to the
variablevar. Parentheses would be needed for clarity in
the following case: “Move next to the$(var)th card”
Because$is used as the referencing character for value
substitution, any use of the dollar sign character must be
escaped. This is accomplished by using$$wherever a real
dollar sign is wanted. The need to use$$applies inside
quoted strings as well as in other uses.
Variables are defined and given value by the setvar el-
ement of WML. For example,
<setvar name = "idcode" value = "123">cre-
ates a value called idcode and assigns it the value 123.
Variables receive a type as determined by the kind of value
assigned.Images and Tables
WML accesses images in the way familiar from HTML. Of
course, the small display area limits the size and complex-
ity of suitable images. WAP has a wireless bitmap graphic
format (WBMP). Some devices will also accept images in
other formats. The syntax for specifying an image for a
WAP card is<img src = "url" alt = "text" />where url is the location of the image to be included and
text is to be displayed if the device is unable to display the
image.
Like images, tables are defined in WML using the
HTML specification. Tables consist of rows, which are
made up of columns. The screen shown in Figure 9 was
produced by the code below:<p>
<table columns = "2" >
<tr>
<td>Item:</td>
<td>Cost:</td>
</tr>
<tr>
<td> 1 </td>
<td> $$27.80</td>
</tr>
<tr>
<td> 2</td>
<td> $$32.80</td>
</tr>
<tr>
<td> 3 </td>
<td> $$47.50</td>
</tr>
</table>
</p>Notice the need to double the dollar sign symbol in or-
der to display a dollar sign. Notice also that the table defi-
nition needs to be nested within a paragraph (<p>..</p>)
element.
Although tables are useful for aligning information on
the screen, the small size of the screen dictates a need for