RE: String problem

Subject: RE: String problem
From: "Dudley, Mark" <Mark.Dudley@xxxxxxxxxxxxx>
Date: Wed, 08 Mar 2000 09:55:55 -0500
Brute force is good. I'll give it a try. Thanks for the response!


-----Original Message-----
From: Maltby, David G [mailto:david.g.maltby@xxxxxxxx]
Sent: Wednesday, March 08, 2000 9:49 AM
To: 'dssslist@xxxxxxxxxxxxxxxx'
Subject: RE: String problem

In my typically brute-force fashion, you can try this:


(element INDEX-ENTRY
 (let ((term-list (match-split (attribute-string (normalize "term")) ";"))
  (let loop ((t-list term-list))
    ((null? t-list)
      (make element gi: "index-entry"
       (let ((name-value-list (match-split (car t-list) ":")))
         (make element gi: "indexprimary"
          (literal (car name-value-list))
         (make element gi: "indexsub"
          (literal (cdr name-value-list))
      (loop (cdr t-list))))))))

definition for (match-split) found at

This procedure should split the term attribute value into a list of
name-value pairs (delimited by the ";") and then loop through the list
creating a <index-entry> set for each pair.  It then splits the name-value
pair on the delimiter ":" and puts the first part in <indexprimary> and the
second part in <indexsub>.  It keeps going until it runs out of name-value

Hopes this works, David

> -----Original Message-----
> From: Dudley, Mark [mailto:Mark.Dudley@xxxxxxxxxxxxx]
> Sent: Wednesday, March 08, 2000 8:32 AM
> To: dssslist@xxxxxxxxxxxxxxxx
> Subject: String problem
> Hello,
> I have a problem and would sincerely appreciate some input. I 
> am conducting
> an SGML to SGML transformation and have run across a bit of a 
> problem. I
> have SGML that looks like this:
> <index-entry term = "No Content documents:description; Content: no
> description">
> and need it to look like this:
> <index-entry>
>   <indexprimary>No Content documents</indexprimary>
>   <indexsub>description</indexsub>
> </index-entry>
> <index-entry>
>   <indexprimary>Content</indexprimary>
>   <indexsub>no description</indexsub>
> </index-entry>
> I was able to do this in XSL but that is not helpful to me as 
> I need valid
> SGML out of the transformation process. Any help/direction 
> would be great.
> Thanks.
> Mark Dudley
> mark.dudley@xxxxxxxxxxxxx
>  DSSSList info and archive:

 DSSSList info and archive:

 DSSSList info and archive:

Current Thread