Subject: Re: read-entity, is there any example or use explication? From: James Clark <jjc@xxxxxxxxxx> Date: Thu, 03 Sep 1998 18:04:06 +0700 |
Norman Walsh wrote: > > / 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. Converting between strings and lists of characters is not very efficient especially for large strings. You would be much better off using string-length/substring/string-ref. James DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: read-entity, is there any examp, Norman Walsh | Thread | Re: read-entity, is there any examp, Norman Walsh |
Re: read-entity, is there any examp, Norman Walsh | Date | Re: read-entity, is there any examp, W. Eliot Kimber |
Month |