Re: Global Variables and JADE vs OMNIMARK

Subject: Re: Global Variables and JADE vs OMNIMARK
From: "W. Eliot Kimber" <eliot@xxxxxxxxxxxxxx>
Date: Sun, 06 Dec 1998 22:46:27 -0600
At 09:02 PM 12/6/98 -0700, Mike Sosteric wrote:

>I have a simple question. Is is possible to extract data from an element
>(at an arbitrary depth in the doc instance) and assign it to a global
variable something 
>like this pseudo code maybee
>
>(define  %text-for-footer% 'publishers 'name 'webaddress)

Short answer: no.

Long answer: When you need the information, go get it from the grove. If
you know where it is going to be and it's a consistent place, you can write
a function that will navigation from the grove root, e.g.:

(define (get-publisher-name node)
  (let ((gr (node-property 'grove-root node)))
    ; do navigation magic here
  ))

>also, I currently use OMNIMARK to get SGML -> HTML conversion. But it
>seems to me that JADE would be good for this, and I've heard JADE has
>a pseudo transformation language suitable for this. Does anybody have an
example of 
>using that to transform SGML -> HTML. Preferably the example would give
examples
>of how to extract data from the grove at arbitrary points in the
transformation.

Check out the SGML Transform back end, part of the base Jade package.  It
provides new flow objects for making marked up output.  It should be pretty
obvious how to use it, but if not, there are lots of examples. Typical
element rules might be:

(root 
  (sosofo-append
    (make formatting-instruction ; Doesn't escape delimiters
      data: (string-append "<" "!DOCTYPE HTML SYSTEM >&#RE;"))
    (process-children)))

(element section1
  (make element gi: "div"
    (process-children)))

(element (section1 title)
  (make element gi: "h1"
    (process-children)))

(element (section1 body)
  (process-children)) 

(element emph
  (let 
   ((gi
    (case (attribute-string "STYLE" (current-node))
     (("BOLD")
      "b")
     (("ITALIC")
      "i")
     (else
      "b"))))
   (make element gi: gi
     (process-children))))

(default
  (process-children))

You can do chunking into multiple output files using the ENTITY flow object.

Cheers,

E.


--
<Address HyTime=bibloc>
W. Eliot Kimber, Senior Consulting SGML Engineer
ISOGEN International Corp.
2200 N. Lamar St., Suite 230, Dallas, TX 75202.  214.953.0004
www.isogen.com
</Address>


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


Current Thread