Re: End tag existance

Subject: Re: End tag existance
From: Tony Graham <tgraham@xxxxxxxxxxxxxxxx>
Date: Thu, 12 Oct 2000 17:16:47 -0400 (EST)
At 12 Oct 2000 16:28 -0400, Russell Steven Shawn O'Connor wrote:
 > Even better, is there a way to determine if an element's content type is
 > EMPTY or not, and whether end tags must be ommitted in this case or not.

(node-property "must-omit-end-tag?" node)

>From "SGML Identity Transformation" in the DSSSL Cookbook:
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(declare-flow-object-class element
  "UNREGISTERED::James Clark//Flow Object Class::element")
(declare-flow-object-class empty-element
  "UNREGISTERED::James Clark//Flow Object Class::empty-element")
(declare-characteristic preserve-sdata?
  "UNREGISTERED::James Clark//Characteristic::preserve-sdata?"

;; Default rule
(default (output-element))

(define (output-element #!optional (node (current-node)))
  (if (node-property "must-omit-end-tag?" node)
      (make empty-element
	    attributes: (copy-attributes))
      (make element
	    attributes: (copy-attributes))))

(define (copy-attributes #!optional (nd (current-node)))
  (let loop ((atts (named-node-list-names (attributes nd))))
    (if (null? atts)
        (let* ((name (car atts))
               (value (attribute-string name nd)))
          (if value
              (cons (list name value)
                    (loop (cdr atts)))
              (loop (cdr atts)))))))


Tony Graham
Tony Graham                            mailto:tgraham@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
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:

Current Thread