Re: Example of multiple html files from one xml file

Subject: Re: Example of multiple html files from one xml file
From: Brandon Ibach <bibach@xxxxxxxxxxxxxx>
Date: Mon, 30 Oct 2000 12:24:46 -0600
Quoting janusz.prusaczyk@xxxxxx <janusz.prusaczyk@xxxxxx>:
> I guess Kathy's and Brandon's examples work too, though not for me...

   Actually, my example (as I said, untested) did have some errors.
Below, find a corrected, tested (and more complete, as far as
including the doctype and flow object declarations) version. :)

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

<style-specification>

(declare-flow-object-class element
  "UNREGISTERED::James Clark//Flow Object Class::element")
(declare-flow-object-class entity
  "UNREGISTERED::James Clark//Flow Object Class::entity")
(declare-flow-object-class formatting-instruction
  "UNREGISTERED::James Clark//Flow Object Class::formatting-instruction")

(define (file-name nd)
   (or (attribute-string "ID" nd)
       (let* ((nds (select-elements
                      (descendants (node-property 'document-element
                                      (node-property 'grove-root nd)))
                      (gi nd)))
              (num (let loop ((n nds) (r 1))
                      (if (node-list-empty? n) 0
                          (if (node-list=? (node-list-first n) nd) r
                              (loop (node-list-rest n) (+ r 1)))))))
             (string-append (gi nd) (number->string num) ".html"))))

(define (make-file fname ssf)
   (make entity system-id: fname
      (make element gi: "html"
         (make element gi: "head"
            (make element gi: "title" (empty-sosofo)))
         (make element gi: "body" ssf))))

(element root (make-file "index.html" (process-children)))

(define (abrule)
   (let ((f (file-name (current-node))))
      (sosofo-append
         (make-file f (process-children))
         (make element gi: "a" attributes: (list (list "href" f))
            (literal (substring f 0 (- (string-length f) 5)))))))

(element a (abrule))
(element b (abrule))

</style-specification>


-Brandon :)


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


Current Thread