Re: Cross-referencing

Subject: Re: Cross-referencing
From: Tony Graham <tgraham@xxxxxxxxxxxxxxxx>
Date: Thu Mar 27 21:41:42 1997 EST
Paul Prescod writes:
 > Here is the change:
 > 
 > > (element THEOREM
 > >   (make paragraph
 > 
 >       (with-mode theorem (process-element-with-id))
 >       (process-children)))

The way I read Matthias's post, the with-mode should be on the proof,
which is the element with the IDREF attribute.

For the sample DTD and document:
- ----------------------------------------
<!DOCTYPE test [
<!--*                   TEST                                      *-->
<!ELEMENT test          - - ((proof | theorem)*)                     >


<!--*                   PROOF OF A THEOREM                        *-->
<!ELEMENT proof         - - (#PCDATA)                                >
<!ATTLIST proof
            of          IDREF                              #REQUIRED >

<!--*                   THEOREM                                   *-->
<!ELEMENT theorem       - - (#PCDATA)                                >
<!ATTLIST theorem
            id          ID                                 #REQUIRED >
]>
<test>
<theorem id="theorem1">The earth is flat</theorem>
<theorem id="theorem2">The stork didn't really bring me</theorem>
<proof of="theorem2">If the stork brought me, I wouldn't need this
belly button</proof>
<proof of="theorem1">Someone told me</proof>
</test>
- ----------------------------------------

the following Jade stylesheet appears to solve the problem:
- ----------------------------------------
<!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">
;; Sample code in response to "Cross-referencing" post by Matthias Clasen

(element TEST
	 (make simple-page-sequence))

(element THEOREM
	 (make paragraph
	       (make sequence
		     (literal
		      (string-append
		       "Theorem "
		       (number->string (child-number))
		       ". "))
		     (process-children))))


(element PROOF
	 (make paragraph
	       (make sequence
		     (with-mode theorem
				(process-element-with-id
				 (attribute-string "OF")))
	       (process-children))))

(mode theorem
      (element THEOREM
	       (literal
		(string-append
		 "Proof of "
		 (number->string (child-number))
		 ": "))))
- ----------------------------------------

The cross-referencing problem that gets me is how, in the absence of
element-with-id, do you support an linking element such as the HTML <A>
element that has content and the content is (one end of) the link to
the referenced element.  The only uses of the link flow object class
that I have seen use the same with-mode and process-element-with-id
combination as in this example, which does not preserve the content of
the linking element.

Regards,


Tony Graham
=======================================================================
Tony Graham, Consultant
Mulberry Technologies, Inc.                         Phone: 301-231-6931
6010 Executive Blvd., Suite 608                     Fax:   301-231-6935
Rockville, MD USA 20852                e-mail: tgraham@xxxxxxxxxxxxxxxx
=======================================================================

Current Thread