|
Subject: node-list question From: Bas Peters <bpeters@xxxxxx> Date: Mon, 3 May 1999 15:31:11 +0200 |
I used this code to strip trailing punctuation:
(define (strip-trailing-punctuation s)
(let ((ls-2 (- (string-length s) 2)))
(case (string-ref s ls-2)
((#\space #\; #\space #\:) (substring s 0 ls-2))
(else s))))
I rewrote parts of my style-sheet, still need the strip-trailing
function, but it doesn't work anymore (was a defined data variable isbn
is now a node-list). Below is a snippet of my code. The line
(strip-trailing-punctuation isbn) calls the function, but it complains
that it does not receive a string:
jade:test.dsl:52:17:E: 1st argument for primitive "string-length" of
wrong type:
"#<unknown object 14628576>" not a string
Does any one know how to strip the last two characters of each node list
value if that value ends with a space and a colon or semi colon?
Here is the code:
; create a paragraph for each isbn number (the ISBN field is
repeatable).
(mode isbn
(element MRCB020-a
(make paragraph
space-before: 2pt
(literal "ISBN ")
(process-children))))
(element MRCB
; get the isbn numbers
(let ((isbn (select-elements (descendants (current-node))
"MRCB020-a")))
; call function strip trailing punctuation
(strip-trailing-punctuation isbn)
; process MRCB element
(make paragraph
space-after: 10pt
keep: #t
(sosofo-append (process-children)
; process node list with MRCB020-a values
(if (not (node-list-empty? isbn))
(with-mode isbn
(process-node-list isbn))
(empty-sosofo))))))
Thanks in advance,
Bas Peters
bpeters@xxxxxx
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: Hidden text with RTF backend, Avi Kivity | Thread | Re: node-list question, Joerg Wittenberger |
| Hidden text with RTF backend, Ferdmann, Kirill | Date | RE: About the source library, Didier PH Martin |
| Month |