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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Make columns, miguel . mata | Thread | Re: Make columns, Chris Maden |
Global Variables, miguel . mata | Date | Re: Make columns, Chris Maden |
Month |