Re: newbie question: store elements as variables

Subject: Re: newbie question: store elements as variables
From: Tony Graham <tgraham@xxxxxxxxxxxxxxxx>
Date: Fri, 9 Oct 1998 09:14:00 -0400 (EDT)
At 8 Oct 1998 15:20 +0200, Bas Peters wrote:
 > I have been trying to store an element in a variable, but I cannot
 > figure out how it works. Any help is welcome.
 > This is the fragment that includes the element:
 > <mrcb099 i1="i1-blank" i2="i2-blank">
 > <mrcb099-a>ILM-4232</mrcb099-a>
 > <mrcb099-c>23.00</mrcb099-c>
 > </mrcb099>
 > Now I want to store the mrcb099-a element into variable *orderNo*
 > I tried something like this, but it does not work:
 > (define (*orderNo*)
 >   (let ((x (select-elements (children (current-node))"MRCB099-a")))
 >   )
 > )
 > I would like to use the variable in a literal as part of another
 > element.

(define (*orderNo*)
   (let ((x (data (children (current-node))"MRCB099-a")))

It may not be necessary to extract the data:

(element mrcb099
   (literal "A string")
   (process-matching-children "mrcb099-a")
   (literal "Another string")))

If there is no element construction rule for <mrcb099-a> and no
default construction rule, then the characters in the <mrcb099-a> will
"make" themselves in the output.

Given the number of elements with which you are dealing, I would
recommend generalising the processing as much as possible to iterate
over node lists rather have explicit element construction rules for
each element type.


Tony Graham
Tony Graham                            mailto:tgraham@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
17 West Jefferson Street                    Direct Phone: 301/315-9632
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

 DSSSList info and archive:

Current Thread