Re: default element construction rule

Subject: Re: default element construction rule
From: Chris Maden <crism@xxxxxxx>
Date: Mon, 16 Mar 1998 15:05:01 -0500
[Steve]
> I'm feeding Jade some HTML, and would like to it to emit stuff only
> for elements I'm interested in.  For example, I'd like it to only
> print out all <H1> text.  Unfortunately, by default, it spits
> something out for every character in the HTML document.  One way to 
> get what I want would be to create an element construction rule for 
> all the elements other than the ones I want, and have them generate 
> (empty-sosofo).  But that seems like a lot of work.
> 
> I've tried changing the default element construction rule, but
> 
> (default (empty-sosofo))
> 
> winds up killing all my output, even if I have a more specific
> construction rule for H2.

I change the default rule to:

(default (process-node-list (element-children)))

;; (element-children) returns the children of a node of class element.
(define (element-children #!optional (snl (current-node)))
  (node-list-filter (lambda (node)
		      (equal? (node-property 'class-name
					     node)
			      'element))
		    (children snl)))

-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
  • default element construction rule
    • stephenng - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id OAA14790Mon, 16 Mar 1998 14:46:41 -0500 (EST)
      • Chris Maden - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id PAA15608Mon, 16 Mar 1998 15:01:04 -0500 (EST) <=
      • <Possible follow-ups>
      • Reynolds, Gregg - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id PAA15897Mon, 16 Mar 1998 15:06:16 -0500 (EST)
      • stephenng - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id PAA16310Mon, 16 Mar 1998 15:23:46 -0500 (EST)
        • Paul Prescod - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id SAA19639Mon, 16 Mar 1998 18:43:29 -0500 (EST)
          • Gregg Reynolds - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id XAA23031Mon, 16 Mar 1998 23:14:03 -0500 (EST)