XML technologies / XSLT / Introduction to XSLT 2.0 / Getting started with XSLT and XPath / A comparison: expression vs. instruction / Concrete values: Literals in a sequence

(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, Chapter 1.)

Instead of describing values in a sequence through XPath expressions, you can insert concrete values directly as numeric or string literals.

The latter must be marked as strings within the sequence, with each enclosed in quotation marks. Pay attention to the kind of quotation marks delimiting the surrounding attribute value:

('Rosen', 'Tulpen', 'Nelken')

This is a sequence of string literals. Spaces outside the string delimiters, such as those beside the commas here, are ignored in this context.

To use the comma itself as a literal, enclose it in quotation marks as a string. The same applies to spaces. Numbers, however, can be used directly. Even an empty sequence can, in principle, appear as a literal:

('hallo', 2, 1, ' ', ',', (), $ein_ausdruck)

As you can see, values can be freely mixed, although empty sequences are immediately discarded. Whether values such as the strings or numbers used here come from an expression makes no difference to the processing instruction. It sees only two kinds of items: those representing nodes and those containing an atomic value.

An atomic value is a value that cannot be subdivided further. This includes numbers, Boolean values and strings, although the indivisibility of strings is debatable in principle. An empty sequence is not an atomic value!

   

back to top