Re: AW: CALS Table to HTML Table via The DSSSList Digest V3 #197

Subject: Re: AW: CALS Table to HTML Table via The DSSSList Digest V3 #197
From: Tony Graham <tgraham@xxxxxxxxxxxxxxxx>
Date: Mon, 25 Oct 1999 13:28:30 -0400 (EST)
At 25 Oct 1999 09:54 +0200, Roland Schopf wrote:
 > I'm using the Docbook Stylesheets for exactly the same purpose.
 > My question now is what modules are necessary?
 > 
 > If I include all modules, I get a lot of warnings and errors like
 > "undefined variable".
 > I already found the answer in the dssslist archive, but when I only
 > include the few modules mentioned there I do not get any resonable
 > result.
 > 
 > Any suggestions?

Simplistic CALS to HTML 3.2 procedures and element construction rules
plucked from an (old) existing stylesheet and untested as a standalone
module:

------------------------------------------------------------
(define (make-table #!optional (children (process-children)))
  (let* ((frameattr (attribute-string "FRAME"))
	 (border (if (and frameattr
			  (string=? frameattr "NONE"))
		     '(("BORDER" "0"))
		     '(("BORDER" "1"))))
	 (width (if (and (attribute-string "PGWIDE")
			 (equal? (attribute-string "PGWIDE") "1"))
		    '(("WIDTH" "100%"))
		    '())))
	 (make element
	       gi: "table"
	       attributes: (append border width)
	       children)))

(define (make-td #!optional (children (process-children)))
  (make element
	gi: "td"
	children))

(define (make-th #!optional (children (process-children)))
  (make element
	gi: "th"
	children))

(define (make-tr #!optional (children (process-children)))
  (make element
	gi: "tr"
	children))

(element TABLE
	 (make-table))

(element TGROUP
	 (process-children))

(element COLSPEC
	 (empty-sosofo))

(element TBODY
	 (process-children))

(element ROW
	 (make-tr))

(element (THEAD ROW ENTRY)
	 (let* ((morerows (attribute-string "MOREROWS"))
		(rowspan (if morerows
			     (list
			      (list "rowspan" (number->string
					       (+
						(string->number morerows)
						1))))
			     '()))
	       (namest (attribute-string "NAMEST"))
	       (nameend (attribute-string "NAMEEND"))
	       (colspan (if nameend
			    (list
			     (list
			      "colspan"
			      (number->string
			       (+
				1
				(-
				 (string->number
				  (attribute-string
				   "COLNUM"
				   (node-list-first
				    (select-elements
				     (children
				      (ancestor "TGROUP" (current-node)))
				     (list "COLSPEC"
					   (list "COLNAME" nameend))))))
				 (string->number
				  (attribute-string
				   "COLNUM"
				   (node-list-first
				    (select-elements
				     (children
				      (ancestor "TGROUP" (current-node)))
				     (list "COLSPEC"
					   (list "COLNAME" namest)))))))))))
			    '())))
	   (make element
		 gi: "th"
		 attributes: (append rowspan colspan))))

(element ENTRY
	 (let* ((morerows (attribute-string "MOREROWS"))
		(rowspan (if morerows
			     (list
			      (list "rowspan" (number->string
					       (+
						(string->number morerows)
						1))))
			     '()))
	       (namest (attribute-string "NAMEST"))
	       (nameend (attribute-string "NAMEEND"))
	       (colspan (if nameend
			    (list
			     (list
			      "colspan"
			      (number->string
			       (+
				1
				(-
				 (string->number
				  (attribute-string
				   "COLNUM"
				   (node-list-first
				    (select-elements
				     (children
				      (ancestor "TGROUP" (current-node)))
				     (list "COLSPEC"
					   (list "COLNAME" nameend))))))
				 (string->number
				  (attribute-string
				   "COLNUM"
				   (node-list-first
				    (select-elements
				     (children
				      (ancestor "TGROUP" (current-node)))
				     (list "COLSPEC"
					   (list "COLNAME" namest)))))))))))
			    '())))
	   (make element
		 gi: "td"
		 attributes: (append rowspan colspan))))
------------------------------------------------------------

Regards,


Tony Graham
======================================================================
Tony Graham                            mailto:tgraham@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
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:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread