Subject: RE: Newbie question From: DPawson@xxxxxxxxxxx Date: Tue, 1 Jun 1999 08:29:21 +0100 |
>From: Guillaume Rouchy wrote: >I am new to DSSSL and I would like to build quickly a simple function >that replace an underscore by a dash in a string: "Hello_World" -> >"Hello-World" this scheme function does it. ; Usage (element (contacts fax) (make paragraph use: para-style (make sequence (literal "Fax number, ") (let ((tel-children (children (current-node)))) (subst tel-children)) (literal ". ")))) ; ; Substituttion function. ; (define (subst nl) (let loop ((charnodes nl)(result (empty-sosofo))) (let* ((firstchar (node-list-first charnodes))) (cond ((node-list-empty? firstchar) result) ((not (equal? 'data-char (node-property 'classnm firstchar))) (loop (node-list-rest charnodes) (sosofo-append result (process-node-list firstchar)))) (#t (let* ((charval (node-property 'char firstchar)) (replacement (cond ((equal? charval #\_) #\-) (#t charval)))) (loop (node-list-rest charnodes) (sosofo-append result (if (char? replacement) (make character char: replacement) (empty-sosofo)) (make character char: #\ ))))))))) > > >Is there an easy way of doing it? Does DSSSL contain regular expression >capability ? > >Thank you to point me in the right direction. > >Guillaume > > > DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist > DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Thread | lines: 'asis, Tony Graham | |
Date | lines: 'asis, Tony Graham | |
Month |