provides an interesting WML feature not found in HTML. When you write
a deck containing several cards, you may find
that parts of the structure are common to all the cards. For example,
it’s fairly typical for each card to have a “back”
control and a “home” control. These controls are normally
<do> elements. It would be
convenient to specify these common elements once per deck rather than
once per card, and that is just what the
<template> element allows.
It doesn’t stop there, though. Remember all those card events
from Chapter 3? Wouldn’t it be easier to set
up bindings for all the events just once for the whole deck? That
would certainly save wear and tear on your fingers (or at least your
cut-and-paste keys), and since WAP is supposed to be optimized for
low bandwidth, it’s a waste of time to have to send all that
duplicated information. As you might have guessed, the
<template> element allows this, too.
You may be wondering what happens if you want a control on most, but not all, of the cards in a deck, or if you want an event binding to apply to just some of the cards. The good news is that this case has also been anticipated: any individual card can override the deck-level settings with its own, or even remove controls or event bindings altogether. This process of overriding is known as shadowing (see the next section for an explanation of shadowing).
<template> element can contain any
<do> elements ...