trim-outer

- SourceForge
- Home Page
- Samples

- Reference Contents |
- Download & Install |
- User Guides |
- Notes, E-mail & Bugs |
- Q&A

Suggestions
Search:
Next: scape.slash.hyphen
Previous: text() (in slash.hyphen mode) Up: Whitespace Normalization and Character Encoding normalize scape.mod.xsl

Reference Section

## Name

trim-outer — Whitespace Normalization and Discretionary Elision

## Synopsis

    <xsl:template name="trim-outer">
    <xsl:param name="string"/>
    <xsl:variable name="trimleft" select="position()=1"/>
    <xsl:variable name="trimright" select="position()=last()"/>
      ...
    </xsl:template>

## A. Description

This template is used by various `text()` templates to normalise interior whitespace and trim whitespace that occurs at the start or end of a DocBook element's content.

## B. Pertinent Variables

There are no configuration variables for this template.

## C. Template Parameters

string
  The text to be processed.

## D. DocBook Compliance and LaTeX Notes

The template is normally called when the context node is within a DocBook document. The elision of leading or trailing whitespace is dependent on values of the XPath functions `position()` and `last()`. This is similar to the handling of whitespace by SGML parsers and allows authors to format their XML documents with “pretty” indentation without causing spurious whitespace in LaTeX.

In all cases, interiour whitespace will be normalised with the XPath `normalize-space()` function. This is necessary to prevent blank-line problems in LaTeX.

Prev | Up | Next
text() (in slash.hyphen mode) | Home | scape.slash.hyphen