Getting the contents of an element

Subject: Getting the contents of an element
From: Georg Rehm <georg@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 20 Apr 1998 10:54:03 +0200 (MEST)
Hi there,

Several regular posters from comp.text.sgml suggested that I should ask
this question on DSSSList. As I subscribed to this list only a couple of
minutes ago the usual disclaimer applies. ;-)

I have a couple (about 900) SGML documents that I want to automatically
convert into HTML documents. The basic structure of the documents is as
follows:

<!DOCTYPE text system "text.dtd"> 
<TEXT> 
	<META> 
		<COPYRIGHT>Copyright [...]</COPYRIGHT>
		<TEXTID>T921116.10</TEXTID>
		<ZEITUNG>TAZ</ZEITUNG> 
		[...]
	</META>

	<PARAGRAPH ID=P1 FKT=H1> <SATZ ID=P1S1 NUM=1>Deutschland, 
	deine T&auml;ter!</SATZ></PARAGRAPH>
	[...]
</TEXT>

After marking up the documents (this happens automatically), I feed the
SGML into jade using the "-t sgml" switch and James Clark's proprietary
extensions to transform SGML documents.

What I'm currently trying to do is to insert the contents of the <TEXTID>
tag (a short string like the above, e.g. "T921116.10") into the <TITLE> 
tag of the resulting HTML document. Furthermore, <TEXTID> has to be pro-
cessed in another place in my DSSSL script (the latter works just fine).
Oisin McGuinness suggested the following function (get-contents gi) in 
an email which he sent to me after my initial posting to comp.text.sgml:

; my top-level gi

(define *top-gi* "TEXT")

; let's do anything with the textid element 

(element textid
        (make element gi: "U")
)

(define (get-contents gi)
        (process-node-list 
                (node-list-first 
                        (select-elements 
                                (descendants (ancestor *top-gi*)) gi))))

; Top-Level Element

(element text
        (make sequence
                (make document-type [...]
                (make element gi: "HTML"
                        (make element gi: "HEAD"
                                (make element gi: "TITLE"
                                        (get-contents "TEXTID")))
                        (make element gi: "BODY"
				[...]
 
This is a kind of lengthy excerpt from my DSSSL "style sheet". I call
(get-contents gi) in the appropriate place, I think. Furthermore, the
function definition looks really good to me. But, and that is the
problem: _Nothing_ happens inside the <TITLE> tag.

Any help to the solution of this bug is really appreciated,

Greetings,
	Georg
-- 
Georg Rehm                                     georg@xxxxxxxxxxxxxxxxxxxxxxx
Institute for Semantic Information-Processing, University of Osnabrueck, FRG


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


Current Thread
  • Getting the contents of an element
    • Georg Rehm - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id CAA08461Tue, 21 Apr 1998 02:07:30 -0400 (EDT) <=
      • Chris Maden - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id KAA19021Tue, 21 Apr 1998 10:41:41 -0400 (EDT)
        • Georg Rehm - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id LAA19474Tue, 21 Apr 1998 11:02:33 -0400 (EDT)
        • Russell Steven Shawn O'Connor - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id LAA19689Tue, 21 Apr 1998 11:08:35 -0400 (EDT)
      • <Possible follow-ups>
      • Reynolds, Gregg - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id MAA21435Tue, 21 Apr 1998 12:19:38 -0400 (EDT)