XML Script logo
Carriage returns - stripping out extra
Usage

Templates use the "__maxCR" attribute to determine the maximum number of permitted consecutive carriage returns. By default, __maxCR is not set, which means that an infinite number of consecutive carriage returns are allowed. Unlike most other attributees, the __maxCR attribute is not inherited, in order to reduce unnecessary processing overhead.

Valid values for __maxCR are blank or -1, (which both turn off __maxCR) and 0-9. The usual setting for __maxCR is 2, because a minimum of two carriage returns is required by HTTP after "Content-type: text/plain" or alternative content declarations. However, this can be set to 1, or even to 0, for use in deeper templates.

When determining the number of consecutive carriage returns, tab characters on lines containing only tab characters and a carriage return are ignored. If the carriage returns on such lines are kept, then so are the tab characters. However, if a ca rriage return on such a line is deleted, then the tab characters on that line are also deleted.

If __maxCR is set on a template, it will act on the template output each time the template is run, so that output consisting of multiple template outputs may have more consecutive CRs than would have been expected. If this is a problem, the _maxCR attribute should be set in a higher element.

The test suite may not behave as expected with respect to __maxCR, because the __maxCR attribute is set in the testing templates themselves. This causes the number of consecutive carriage returns to be limited, but may also cause the removal of tab characters on lines containing only tab characters and a carriage return.

Examples

Template without __maxCR

Template using __maxCR

Version

1.0

Ref

t.9

Date

14 March 1999

XML Script homepage | Documentation home | XML Script docs | Command list | Function list | X-Tract docs

X-Stream, X-Tract and XML Script are trade marks of DecisionSoft Limited
© Copyright 1998-2000 DecisionSoft Limited