Re: read-entity, is there any example or use explication?

Subject: Re: read-entity, is there any example or use explication?
From: Norman Walsh <ndw@xxxxxxxxxx>
Date: Thu, 3 Sep 1998 06:40:04 -0400
/ miguel.mata@xxxxxxxxxx was heard to say:
| Hi, I don't know how can I use read-entity to access datas from another
| file, do you know it?, or have you any example?

From my DocBook stylesheets, v1.13:

(define ($include$ fileref)
  (let* (;; Yes, the next line really ends with "#", "\", "[newline]"
	 (newline #\
)
	 (file-content  (read-entity fileref))
	 (file-charlist (string->list file-content))
	 (file-length   (length file-charlist))
	 (file-headlist (list-head file-charlist (- file-length 1)))
	 (file-taillist (list-tail file-charlist (- file-length 1)))
	 ;; If the last char is a newline, drop it, otherwise print it...
	 (content (if (equal? newline (car file-taillist))
		      (list->string file-headlist)
		      file-content)))
    (make sequence
      (literal content))))

All that hackery about the last character is to avoid an extra linefeed,
it's unnecessary if you're going to use the data somehow (i.e. in some
SGMLish way) and probably unnecessary if you're not dropping the data
into an asis environment.

                                        Cheers,
                                          norm
-- 
Norman Walsh <ndw@xxxxxxxxxx>      | Whatever you do may seem
http://nwalsh.com/                 | insignificant, but it is most
                                   | important that you do it.--Ghandi


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread
  • read-entity, is there any example or use explication?
    • miguel . mata - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id EAA04085Thu, 3 Sep 1998 04:52:12 -0400 (EDT)
      • Norman Walsh - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id GAA05960Thu, 3 Sep 1998 06:42:21 -0400 (EDT) <=
        • James Clark - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id HAA06733Thu, 3 Sep 1998 07:21:39 -0400 (EDT)
          • Norman Walsh - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id KAA19305Thu, 3 Sep 1998 10:44:16 -0400 (EDT)
          • Tony Graham - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id MAA29505Thu, 3 Sep 1998 12:33:29 -0400 (EDT)
          • Russell Steven Shawn O'Connor - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id KAA12102Fri, 4 Sep 1998 10:33:37 -0400 (EDT)