Common XSLT Utilities

Templates
utils.strip_newlines

Strips leading or trailing newlines from a string

utils.strip_newlines

utils.strip_newlinesStrips leading or trailing newlines from a string

Parameters

string

The string to strip newlines from

leading

Whether to strip leading newlines

trailing

Whether to strip trailing newlines

Description

This template strips at most one leading and one trailing newline from string. This is useful for preformatted block elements where leading and trailing newlines are ignored to make source formatting easier for authors.