Re: Using SUBDOCs

Subject: Re: Using SUBDOCs
From: Alexander Taranov <tay@xxxxxxxxxx>
Date: Thu, 15 Oct 1998 11:15:53 +0400 (MSD)
Chuck, below is full toy example
It is assumed that master doc contains    
  <docref ref="some-entity">
and "some-entity" is docbook ARTICLE.

result is -- identical transformation of master doc
and substitution in place of docref 
<ARTICLE-TITLE>..whatever title is</ARTICLE-TITLE>

-------------- cut here --------------------------------------

<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

<style-sheet>
  <style-specification id="main" use="ext-defs ident">
    <style-specification-body>

(default (same-element))

(element 
 docref
 (let ((file (entity-system-id (attribute-string "ref"))))
  (with-mode mk-xref
	     (process-node-list
	      (sgml-parse file)))))

;;;;;;;;;;;;;; subdoc processed here ;;;;;;;;;;;;;;
;; it is toy subdoc processing
;; it just extracts from ARTICLE its title  and inserts it into
;; main doc

(mode mk-xref
 
  (default (empty-sosfo))

  (element ARTICLE
	   (process-children))
  
  (element ARTHEADER (process-children))
  (element TITLE (make element
			   gi: "ARTICLE-TITLE" ;; just for example
			   (process-children)))
  
  )

</style-specification-body>
  </style-specification>
  <style-specification id="ident" use="ext-defs">
    <style-specification-body>
(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)))))))

(define (same-element #!optional (nd (current-node)))
  (make element
	gi: (gi nd)
	attributes: (copy-attributes nd)))
</style-specification-body>
  </style-specification>
  <style-specification id="ext-defs">
<style-specification-body>
(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-flow-object-class document-type
  "UNREGISTERED::James Clark//Flow Object Class::document-type")
(declare-flow-object-class processing-instruction
  "UNREGISTERED::James Clark//Flow Object Class::processing-instruction")
(declare-flow-object-class entity
  "UNREGISTERED::James Clark//Flow Object Class::entity")
(declare-flow-object-class entity-ref
  "UNREGISTERED::James Clark//Flow Object Class::entity-ref")
(declare-flow-object-class formatting-instruction
  "UNREGISTERED::James Clark//Flow Object Class::formatting-instruction")
(declare-characteristic preserve-sdata?
  "UNREGISTERED::James Clark//Characteristic::preserve-sdata?"
  #f)    
</style-specification-body>
  </style-specification>
</style-sheet>


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread