|
Subject: RE: String problem From: "Maltby, David G" <david.g.maltby@xxxxxxxx> Date: Wed, 08 Mar 2000 10:36:32 -0500 |
Sorry Mark this won't work as written:
>
> (element INDEX-ENTRY
> (let ((term-list (match-split (attribute-string (normalize
> "term")) ";"))
> (let loop ((t-list term-list))
> (cond
> ((null? t-list)
> (empty-sosofo)
> )
> (else
> (sosofo-append
> (make element gi: "index-entry"
> (let ((name-value-list (match-split (car t-list) ":")))
> (sosofo-append
> (make element gi: "indexprimary"
> (literal (car name-value-list))
> )
> (make element gi: "indexsub"
> (literal (cdr name-value-list))
> ))))
> (loop (cdr t-list))))))))
I forgot that (match-split) returns in the list the delimiter also. That
is, for your term="No Content documents:description; Content: no
description", splitting on ";" will return:
("No Content documents:description" ";" "Content: no description")
and in the same way splitting the name-value pairs would return:
("No Content documents" ":" "description")
("Content" ":" "no description")
The above procedure does not take the delimiter into account. Try this
instead:
(element INDEX-ENTRY
(let ((term-list (match-split (attribute-string (normalize "term")) ";"))
(let loop ((t-list term-list))
(cond
((or (null? t-list) (string=? (car t-list) ";")) ;not sure: if null?
is #t
(empty-sosofo) ;then string=?
errors?
)
(else
(sosofo-append
(make element gi: "index-entry"
(let ((name-value-list (match-split (car t-list) ":")))
;TODO: add error checking on return before processing
(sosofo-append
(make element gi: "indexprimary"
(literal (car name-value-list)) ;first atom in list
)
(make element gi: "indexsub"
(literal (cddr name-value-list)) ;third atom, second atom is
delimiter
))))
(loop (cdr t-list))))))))
David
"nothing like making your foibles public" dm
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: String problem, Dudley, Mark | Thread | OpenJade home page update, Didier PH Martin |
| RE: String problem, Dudley, Mark | Date | Re: XML encoding from a DSSSL style, Stephane Bortzmeyer |
| Month |