Re: Field records backend ?

Subject: Re: Field records backend ?
From: "Mitch C. Amiano" <amiamc@xxxxxxxxxxxxxxx>
Date: Tue, 11 Apr 2000 09:40:26 -0400
(Sorry for the last message; I inadvertently hit send while editing the email)

You could use the formattinginstruction extension in Jade to do this.

I imagine a solution in DSSSL could use a list to describe the 
output record in terms of the field sizes, call string-length
to figure out how much to pad field content to fit, and generate
an error message if the actual field content overflows.

Something remotely like the following (which is completely untested):


<inputrecord f1="Foo" f2="Bar" f3="Baz" />


(declare-flow-object-class formatting-instruction
  "UNREGISTERED::James Clark//Flow Object Class::formatting-instruction")
;; wrapper for attribute-string which returns an empty string instead of #f
(define (attval str #!optional (nl (current-node)) (dfltstring ""))
   (let ((v (attribute-string str nl)))
      (if (string? v)  v dfltstring )

(define recdesc (list 3 4 5) )   ; field sizes
(define padding "     " )        ; fill characters

   (let loop
        (fields (list (attval "F1") (attval "F2") (attval "F3") )
        (rd recdesc)
      (if (null? fields)
           (car fields)
                 (fieldsize (car recdesc))
                 (contentlen (string-length (car fields)))
              (if (>= fieldsize contentlen )
                 (substring padding 
                   (+ 1 (- fieldsize contentlen) )
           (loop (cdr fields) (cdr rd) )

Jany Quintard wrote:
> Hi all.
> I am looking for a way to output records with fixed length fields from
> SGML/XML. I think that there are a lot of possibilities, such as
> outputting a very simple SGML and processing it with some script, but I
> wondered if someone had done this before and which tools could be used
> (Openjade + ???)
> Any hints.
> Jany.
>  DSSSList info and archive:

--                                                                        --
Mitch C. Amiano                               Mitch.C.Amiano@xxxxxxxxxxxxxxx
SDE, ET&PE, Eng. Services, Raleigh Design Center, Alcatel USA

Could a rubber ball bounce off a frictionless surface?

 DSSSList info and archive:

Current Thread