Read XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition Online
Authors: Michael Kay
If backward-compatibility mode is in use (that is, if
version = “1.0”
is specified), then all strings after the first in the sequence are discarded; only the first string is included in the output. See the section
Version Compatibility
on page 128 for details.
For example, suppose you have a set of images representing an alphabet such as the following, and you want to use these to represent the first character of a paragraph of text.
You could write a template rule to achieve this as follows (ignoring practical details such as how to deal with paragraphs that don't start with a capital letter). It uses the
substring()
function, which is described in Chapter 13.
A paragraph that starts with the letter A (like this one) will cause the
src
attribute of the
element to be evaluated as
img src = “fancyA.gif”
, so it will be displayed in the browser as shown in
Figure 3-5
.
If you want to include the characters
{
or
}
in an attribute value with their ordinary meaning, they should be doubled as
{{
or
}}
. This is sometimes necessary when generating dynamic HTML, and it also happens often with the
regex
attribute of the