--- Begin Message ---
Subject: DSSSL library
From: Vivek Agrawala <vivek@xxxxxxxxxxxxxxx>
Date: Wed, 25 Jun 1997 17:51:41 -0400
|
Dave Love wrote:
>
> `string-ci>?'; also is the sort itself optimal? [I have O' Keefe's
> mergsort coded if it's any use.]
>
> Is there somewhere to deposit such library-like stuff?
Collecting such things in one place seems like a good idea.
Here are a few things I collected from some recent posts. (see
attachment)
-- Vivek Agrawala
Siemens Corporate Research, Inc. email: vivek@xxxxxxxxxxxxxxx
;; -- Similar to child-number, but also counts siblings with a GI
;; -- different than that of 'snl'.
(define (absolute-child-number snl)
(+ 1 (node-list-length (preced snl))) )
;; -- Does 'snl' have a child with GI 'gi'.
(define (has-child? gi snl)
(not (node-list-empty? (select-elements gi (children snl)))) )
;; -- In 'str', substitute all occurences of 'old-char' with 'new-char'.
(define (substitute-char str old-char new-char)
(let ( (n (string-length str)) )
(let loop ( (i 0) (newstr "") )
(cond
( (< i n) (loop (+i 1) (string-append newstr (string
(if (equal? (string-ref str i) old-char)
new-char
(string-ref str i) )))))
( (equal? i n) newstr ) ))))
;; ---- define some standard functions not currently available in Jade
(define (match-element? pattern snl)
(if (node-list-empty? (select-elements snl pattern)) #f #t) )
(define (ipreced snl)
(.... ))
;; ---- some other useful DSSSL constructs
For example, the mechanism for selective processing of elements
mentioned in the thread on "A better way to be selective".
--- End Message ---