Re: Problem with Topic maps

Subject: Re: Problem with Topic maps
From: "W. Eliot Kimber" <eliot@xxxxxxxxxxxxxx>
Date: Tue, 09 Feb 1999 20:52:54 -0600
At 08:45 PM 2/9/99 -0500, Didier PH Martin wrote:
>I already get a DSSSL rule for displaying the topic description. It works
>ok. The problem I have is to create a HTML link for each topic name. The
>HTML link should be the entity location. I am lost and don't know how to do
>it.

You can process multiple documents at the same time, using the sgml-parse
function. Thus, when you need to create the URL of some element in another
document, you just parse that document and apply some deterministic rule to
it to generate the HREF and the NAME.  Note that even though your code may
call sgml-parse many times, Jade will only construct the grove once per
processing run.

You can get the generated system ID of the entity--this will be unique and
can therefore be hashed into a unique output HTML filename. You can use the
element-number (or something like that) function to create a reliably
unique ID for the element.

Remember that the generated-syste-id property is a formal system identifier
(FSI) that uses the FSI escaping mechanism to escape path separators.
You'll need to unescape these to get a real filename.  

Here's a function that does this:

<funcheader>
<funcname>fsi->filename</funcname><description>
<para>Parses a formal system ID into a filename</para>
</description>
<arguments>
<argument><arg>fsi</arg><desc>An FSI (such as returned by generated-system-id)
</desc></argument>
</arguments>
</funcheader>

(define (fsi->filename fsi)
  (let loop ((fsi fsi) (fsitag "") (sysid "") (intag #f))
    (if (equal? fsi "")
      sysid
      (let ((c (substring fsi 0 1)))
        (if intag
          (if (equal? c ">")
            (loop (substring fsi 1 (string-length fsi))
                     (string-append fsitag c) sysid #f)
            (loop (substring fsi 1 (string-length fsi))
                     (string-append fsitag c) sysid intag))
          (if (equal? c "&lt;")
            (loop (substring fsi 1 (string-length fsi))
                  fsitag sysid #t)
            (loop (substring fsi 1 (string-length fsi))
                  fsitag (string-append sysid c) intag)))))))

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