Re: Make columns

Subject: Re: Make columns
From: Chris Maden <crism@xxxxxxxxxxx>
Date: Tue, 25 Aug 1998 11:46:56 -0400 (EDT)
miguel.mata@xxxxxxxxxx
> Hi, I have this SGML file:
> 
> <data>1</data>
> <data>2</data>
> <data>3</data>
> <data>4</data>
> <data>5</data>
> <data>6</data>
> <data>7</data>
> <data>8</data>
> <data>9</data>
> 
> I want to make this columns in a HTML file:
> 
> 1	6
> 2	7
> 3	8
> 4	9
> 5

What the heck; I'm bored.  Assuming you have some element that
contains the <data> (call it <datalist>):

(element datalist
         (make element
               gi: "TABLE"
               (let* ((cells (- (node-list-length (children (current-node)))
                                1))
                      (rows (/ cells
                               2)))
                 (let dataloop
                   ((rowidx 0))
                   (sosofo-append (make element
                                        gi: "TR"
                                        (process-node-list (node-list-ref (children (current-node))
                                                                          rowidx))
                                        (if (<= (+ rowidx
						   rows
						   1)
                                                cells)
                                            (process-node-list (node-list-ref (children (current-node))
                                                                              (+ rowidx
										 rows
										 1)))
                                            (empty-sosofo)))
                                  (if (= rowidx
                                         rows)
                                      (empty-sosofo)
                                      (dataloop (+ rowidx
                                                   1))))))))

(element data
         (make element
               gi: "TD"))

I haven't tested this, but this should illustrate the idea.

-Chris
-- 
<!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN">
<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread
  • Make columns
    • miguel . mata - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id GAA16211Tue, 25 Aug 1998 06:08:21 -0400 (EDT)
      • Chris Maden - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id LAA02078Tue, 25 Aug 1998 11:51:39 -0400 (EDT) <=
      • Chris Maden - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id LAA02112Tue, 25 Aug 1998 11:52:01 -0400 (EDT)