Re: sgml-parse working example required

Subject: Re: sgml-parse working example required
From: James Clark <jjc@xxxxxxxxxx>
Date: Thu, 29 May 1997 21:03:52 +0700
At 17:54 29/05/97 MSD, Tsyshevsky Vladimir wrote:
>Hi,
>
>jade_08 implements new primitive
>
>(sgml-parse string #!key active: parent:) 
>
>which is described in standard as follows:
>
>  Returns a node-list containing a single node that is the root of a grove
built by
>  parsing an SGML document or subdocument using the SGML property set.
string is
>  the system identifier of the SGML document entity or SGML subdocument entity.
>  active: is a list of strings specifying the names of the active DTD or
LPDs. At most
>  one DTD shall be active...
>
>a) It looks like the 'string' argument is used as filename, but not as
>entity name;

It's a system identifier as the standard requires.

>b) I failed to parse the subdocument with it's own dtd, it looks like
>the parent documents's dtd always used

It works for me.

Here's an example:

<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN">

(root (make simple-page-sequence))

(element p (make paragraph))

(element para (make paragraph))

(element include
  (process-node-list
   (document-element
    (sgml-parse
     (entity-generated-system-id
      (attribute-string "entity"))))))

(define read-entity
  (external-procedure "UNREGISTERED::James Clark//Procedure::read-entity"))

(element example
  (make paragraph
    font-family-name: "Courier"
    input-whitespace-treatment: 'preserve
    lines: 'asis
    (literal
     (read-entity
      (entity-generated-system-id
       (attribute-string "entity"))))))
	
(define (document-element #!optional (node (current-node)))
  (node-property 'document-element node default: (empty-node-list)))

Here's a document entity you can try it with:

<!doctype doc system "include.dtd" [
<!entity e system "include2.sgm" subdoc>
]>
<p>
Paragraph the first.
<include entity=e>
<p>
Paragraph the second.
<include entity=e>
<example entity=e>

include.dtd:

<!element doc  o o (p|include|example)*>
<!element p - o (#pcdata)>
<!element include - o empty>
<!element example - o empty>
<!attlist (example|include) entity entity #required>
<!notation sgml public "ISO 8879:1986//NOTATION SGML//EN">

include2.sgm:

<!doctype doc [
<!element doc o o (para+)>
<!element para - o (#pcdata)>
]>
<para>
Included paragraph the first.
<para>
Included paragraph the second.








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


Current Thread