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

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"
	       (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)
	   (sosofo-append (case (node-property 'class-name
				;; handle special characters
				((data-char) (case (node-property 'char
						   ;; ampersand
						   ((#\&) (make entity-ref 
								name: "amp"))
						   ;; etc....
						   (else (process-node-list this-node))))
				;; handle SDATA entity references
				((sdata) (case (node-property 'system-data
					       ;; 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).

<!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
"<URL> <TEL>+1.617.499.7487
<USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>

 DSSSList info and archive:

Current Thread