Two questions: (sgml-parse) and (data)

Subject: Two questions: (sgml-parse) and (data)
From: "W. Eliot Kimber" <eliot@xxxxxxxxxx>
Date: Thu, 29 May 1997 22:06:36 -0900
Two questions, largely unrelated except by arising from the same document
type:

1. I've figured out a way to get the content of an element in order to set the
   running head.  I'm wondering if I've found the best way--it seemed harder
   than necessary, but my analysis of the available functions didn't reveal
   anything obviously better.

   The instance looks like:

   <topic>
    <topicmetadata>
     <title>this is the title</title>
    ...

   Here's my function to get the content of the Title element and
literalize it for
   the header:

    left-header:  (literal (data
                   (node-list-first
                    (children
                      (node-list-first
                        (children (current-node)))))))

   This works fine, but seems a bit crude. 

2. Autonumbering through sgml-parse

I got sgml-parse to work for processing subdocuments (very cool, I must
say--I had the document already and was just waiting for the function to be
implemented), but realized that I don't know how to look up through the
reference in order to autonumber the document element of the included
subdoc based on the child number of the referencing document.  The
reference looks like this:

<!DOCTYPE Course SYSTEM 
  <!ENTITY topic1 SYSTEM SUBDOC>
  <!ENTITY topic2 SYSTEM SUBDOC>
]>
<course>
 ....
 <topicref subdoc=topic1><!-- Reference to Topic subdoc -->
 <topicref subdoc=topic2><!-- Reference to Topic subdoc -->
 ...
</course>

The subdocs look like:

<!DOCTYPE Topic SYSTEM >
<topic>
 <topicmetadat>
  <title>....</title>

The formatting I want is for the topics to be numbered sequentially:

Topic 1. this is the title
  ...
Topic 2. this is the title

The problem is that the usual (child-number (ancestor (current-node)))
approach can't see
past the subdoc's document element.  

I guess I could generate the number on the reference, but right now I have
all that machinery on the Title element--I don't like the separate the
numbering from the text that the number is presented with (the Title
content).  Also, I need the number for the generated heading, which is
generated by the Topic element, not it's reference.  Can I use "let" to
make the child number of the reference available to the referenced subdoc's
processing?

Is there a way to get back to the element from which the subdoc was
referenced so that I can count it?  I thought the (source) function would
do it, but (source) doesn't appear to be supported by 0.8.

Thanks,

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

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


Current Thread