Re: Jade for HTML

Subject: Re: Jade for HTML
From: James Clark <jjc@xxxxxxxxxx>
Date: Wed, 23 Apr 1997 18:32:48 +0700
At 18:31 22/04/97 +0700, I wrote:
>At 22:10 21/04/97 -0400, Paul Prescod wrote:
>>Is the Jade SGML transformation engine appropriate for multiple document
>>HTML websites?

>It provides an easy way (the entity flow object) to produce multiple output
>files.  It doesn't do the automatic translation of link flow objects into A
>elements that the HTML backend does, and it would be non-trivial to do it
>with  the SGML transformation backend.

After thinking about it a bit, I don't think it's too hard to do this in the
SGML transformation backend.  The key thing is to have a way to generate a
unique string identifier for an element. If you have this, then can easily
generate the <A NAME=...></A> elements explicitly. One way to generate a
unique string identifier reasonably efficiently is to generate an xpointer
of the form

  ID(foo)CHILD(bar,17)(baz,21)

or

  ROOT,CHILD(foo,3)(bar,17)

depending on whether there's an element with an ID in the element's
ancestry.  This is quite easy to generate in DSSSL.

At the moment the HTML backend uses the index of the element in the document
(ie the number of element s with any gi that started before the element).
It would probably be useful to have an external procedure that makes that
available.

James

(define (generate-xptr #!optional (nd (current-node)))
  (let loop ((suffix "")
	     (nd nd))
    (let ((eid (id nd)))
      (if eid
	  (string-append "ID("
			 eid
			 ")"
			 (if (= (string-length suffix) 0)
			     ""
			     (string-append "CHILD"
					    suffix)))
	  (let ((par (parent nd)))
	    (if (not (node-list-empty? par))
		(loop (string-append "("
				     (number->string (child-number nd))
				     ","
				     (gi nd)
				     ")"
				     suffix)
		      par)
		(string-append (if (= (string-length suffix) 0)
				   "ROOT"
				   "ROOT,CHILD")
			       suffix)))))))



Current Thread