Re: DSSSL capabilities - was RE: TOC problem with HTML32 dsssl

Subject: Re: DSSSL capabilities - was RE: TOC problem with HTML32 dsssl
From: Chris Maden <crism@xxxxxxx>
Date: Fri, 17 Oct 1997 12:12:45 -0400
[Paul Prescod]
> I would suggest that the simplest thing for you to do is use Python,
> Perl or Awk on the output of Jade. There is no reason to contort
> your stylesheets horribly rather than using a "filter" post-process.

It doesn't really "contort" the stylesheet, but it does make the
processing time double or worse.  Here's what I do, for both my MIF
generation and HTML output.  This is necessary to catch SDATA
entities, since Jade doesn't yet support the (query) construction
rule.

An example use for a DocBook to HTML convertor, using the SGML
backend; use (process-text) as the content-expression for any
mixed-content element's construction rule.

(element CITETITLE
	 (make element
	       gi: "CITE"
	       attributes: (list (list "CLASS"
				       "CITETITLE"))
	       (process-text (current-node))))

The function definition:

(define (process-text snl)
  (let p-t-loop ((this-node (node-list-first (children snl)))
		 (other-nodes (node-list-rest (children snl))))
       (if (node-list-empty? this-node)
	   (empty-sosofo)
	   (sosofo-append (case (node-property 'class-name
					       this-node)
				;; handle special characters
				((data-char) (case (node-property 'char
								  this-node)
						   ;; ampersand
						   ((#\&) (make entity-ref 
								name: "amp"))
						   ;; etc....
						   (else (process-node-list this-node))))
				;; handle SDATA entity references
				((sdata) (case (node-property 'system-data
							      this-node)
					       ;; a with grave accent
					       (("[agrave]") (make entity-ref
								   name: "agrave"))
					       ;; ampersand
					       (("[amp   ]") (make entity-ref
								   name: "amp"))
					       ;; etc.... no else
					       ))
				(else (process-node-list this-node)))
			  (p-t-loop (node-list-first other-nodes)
				    (node-list-rest other-nodes))))))

I use this same function in the MIF convertor to catch quotes and
carriage returns, and to create ligatures ('f's are dropped if the
next character is 'i' or 'l' and they're not in a literal; 'i's and
'l's generate ligatures instead of themselves if the previous
character was an 'f' and they're not in a literal).

-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