Re: 3 questions

Subject: Re: 3 questions
From: Norman Walsh <ndw@xxxxxxxxxx>
Date: Mon, 7 Dec 1998 14:21:57 -0500
| How can I have access to a tag content as a string?
| I would like to turn :
| <email>yesod@xxxxxxxxxxx</email>
| into :
| <a href="mailto:yesod@xxxxxxxxxxx";>yesod@xxxxxxxxxxx</a>

(element email
  (make element gi: "a"
        attributes: (list (list "href" (string-append "mailto:";) (data)))

| How can I insert the content of an HTML file as a replacement for a tag?
| So I can use tags like
| <include file="file.html">

(define (include-file fileref)
  ;; REFENTRY lib-include-file
  ;; PURP Return the literal content of fileref
  ;; DESC
  ;; Opens and loads fileref with (read-entity); returns the content
  ;; of fileref as a (literal).  Trims the last trailing newline off
  ;; the file so that "the right thing" happens in asis environments.
  ;; /DESC
  (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))
    (literal content)))

(element include
  (include-file (attribute-string "file")))

| Is it possible to do a system call from Dsssl, like (system) in scheme?

No, that would introduce the possibility of side effects. (Not to 
mention the usual culprits of security, cross platform support, etc.)

Norman Walsh <ndw@xxxxxxxxxx>      | Imagine if every Thursday your                 | shoes exploded if you tied them
                                   | the usual way. This happens to us
                                   | all the time with computers, and
                                   | nobody thinks of
                                   | complaining.--Jeff Raskin

 DSSSList info and archive:

Current Thread