## f:spaces

f:spaces — Returns a string of spaces.

Function:

{http://docbook.org/ns/docbook/functions}spaces#1

Defined in:

modules/functions.xsl

Used in:

modules/functions.xsl, modules/programming.xsl

Used by:

## Synopsis

f:spaces( | `$length` as item()*) as `xs:string?` |

## Description

This function returns a string of `$length`

spaces.
If `$length`

:

- is empty, an empty sequence is returned.
- is an integer, or castable to an integer, a string of that length is returned. If the length is negative, an empty sequence is returned.
- is anything else, the length of the string value of
`$length`

is used as the length.

In other words:

`f:spaces(())`

is ‘`()`

’,`f:spaces(0)`

is ‘’ (no spaces),`f:spaces(-1)`

is ‘`()`

’,`f:spaces(2)`

is ‘ ’ (two spaces),`f:spaces("1")`

is ‘ ’ (one space), and`f:spaces("test")`

is ‘ ’ (four spaces).

This function accepts a sequence to support the empty sequence.
If it’s passed a sequence of more than one item, it treats that as if
the string values of the items had been concatenated together. This can
have slightly surprising consequences as “`('a', '3', '0')`

”
will return a string of three spaces whereas
“`('0', '3', '0')`

” will return a string of thirty.