DSSSL Library Reference: Part of the Modular DocBook Stylesheet distribution
Prev |  | Next

# include-characters

## Name

include-characters -- Return the character content of fileref

## Synopsis

    (include-characters fileref)

## Description

Opens and loads fileref with (read-entity); returns the content of fileref as characters. Trims the last trailing newline off the file so that "the right thing" happens in asis environments.

## Author

Norman Walsh, <ndw@nwalsh.com>

## Source Code

    (define (include-characters fileref)
      ;; Return the character content of fileref
      (let* ((newline #\U-000D)
    	 (file-content  (read-entity fileref))
    	 (file-length   (string-length file-content))
    	 ;; If the last char is a newline, drop it, otherwise print it...
    	 (content       (if (equal? newline (string-ref file-content
    							(- file-length 1)))
    			    (substring file-content 0 (- file-length 1))
    			    file-content)))
        content))

Prev | Home | Next
include-file | Up | url-encode-char