RE: Example of multiple html files from one xml file

Subject: RE: Example of multiple html files from one xml file
From: janusz.prusaczyk@xxxxxx
Date: Mon, 30 Oct 2000 13:36:43 +0100
Hi everybody,

I have the answer for my question. Jany Quintard from IBM Paris Laboratory
showed me the example which I managed to use. I guess Kathy's and Brandon's
examples work too, though not for me... <sigh/> Maybe I am just using wrong
parameters to OpenJade (it took me two tries before I guessed correct
parameters for Jany Quintards example - I tried to use -t html in place of
-t sgml). 

I send this answer to the list, because I think there are people on this
list which have similar problems to mine and are interested in solution.

Thank you all for your suggestions. I will try to learn how to make all the
examples work, to decrease my ignorance.

The command I use to process my files: openjade -t sgml -d site.dsl site.xml

The stylesheet:

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

;; general definitions
(define debug
  (external-procedure "UNREGISTERED::James Clark//Procedure::debug"))
(declare-flow-object-class element
  "UNREGISTERED::James Clark//Flow Object Class::element")
(declare-flow-object-class entity
  "UNREGISTERED::James Clark//Flow Object Class::entity")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; local functions
; build the name of a a file (a followed by the number)
(define (name_afile #!optional (snl (current-node)))
 (string-append "a" (number->string (child-number snl))))

; build the name of a b file (b followed by the number of the
; parent and the nulmber of the b.
(define (name_bfile #!optional (snl (current-node)))
  (string-append "b-"
                 (number->string (child-number (parent snl)))
                 "-"
                 (number->string (child-number snl))))

;;  appends .html to a file name's radical
(define (filename string)
  (string-append string ".html"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; main mode
(element root
  (sosofo-append
    (make entity system-id: "index.html"   ; builds index
      (make element gi: "head"
        (make element gi: "title" (literal "Index file")))

      (make element gi: "body"
        (process-children)))

  (with-mode afiles (process-children))))  ; creates a files

(element a
  (make element gi: "div"
    (make element  gi: "a"
           attributes: (list (list "href" (filename (name_afile))))
        (literal "a" (number->string (child-number))))))

(element b (empty-sosofo))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(mode afiles

  (element a
    (sosofo-append
      (make entity system-id:  (filename (name_afile))
        (make element gi: "html"
          (make element gi: "head"
            (make element gi: "title" (literal "A a file")))
          (make element gi: "body"
            (process-children)))

      (with-mode bfiles (process-children)))))  ; creates b files

  (element b
    (make element gi: "div"
      (make element  gi: "a"
             attributes: (list (list "href" (filename (name_bfile))))
        (literal (name_bfile)))))

)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(mode bfiles

  (element b
    (make entity system-id:  (filename (name_bfile))
      (make element gi: "html"
        (make element gi: "head"
          (make element gi: "title"
            (literal "A b file")))
        (make element gi: "body"
          (make element gi: "div"
            (process-children))))))

)
</style-specification>


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


Current Thread