Re: How to edit an html fragment inside a document, implicitly wrapped in HTML and BODY

Lennart Staflin <[email protected]> Thu, 16 Nov 2006 19:06:22 +0100
Newsgroups gmane.emacs.psgml.user
Message-ID <[email protected]>
On 16 nov 2006, at 16.33, Christian Nybø wrote:

> Syd Bauman <[email protected]> writes:
>
>> I think you want to see the documentation section "Using a Split
>> Document".
>
> Yes, that may be a step in the right direction.
>
>  -- User Option: sgml-parent-document
>      Used when the current file is part of a bigger document.
>
>      The variable describes how the current file's content fit into  
> the
>      element hierarchy.  The variable should have the form
>
>           (PARENT-FILE CONTEXT-ELEMENT* TOP-ELEMENT (HAS-SEEN- 
> ELEMENT*)?)
>
>     PARENT-FILE
>           is a string, the name of the file containing the document
>           entity.
>
> So I want this to be a string that is the pathname of a file
> containing the string:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>                       "http://www.w3.org/TR/html4/loose.dtd">
>
>     CONTEXT-ELEMENT
>           is a string, that is the name of an element type.  It can
>           occur 0 or more times and is used to set up exceptions and
>           short reference map.  Good candidates for these elements are
>           the elements open when the entity pointing to the current
>           file is used.
>
> Could the first line be written as "CONTEXT-ELEMENT is the name of an
> element type, as a string." ?

Yes. In this case CONTEXT-ELEMENT should be "HTML" and TOP-ELEMENT  
should be "BODY". Body is inside HTML. But because you don't actually  
have the "BODY" tag in your file you need an empty HAS-SEEN-ELEMENT  
list. Some thing like this:

    ("mydecl.html" "HTML" "BODY" ())


That said, I am doubt that mmm-mode will work in this case. PSGML  
tries to parse the whole buffer, and unless mmm-mode actually manages  
to hide parts of the buffer from PSGML it will probably fail if there  
is anything outside the html fragments that makes the whole buffer  
invalid html.


>     HAS-SEEN-ELEMENT
>           is a string that is the name of an element type.  This
>           element is satisfied in the content model of top-element.
>
> What is required from an element for it to be satisfied in a content
> model?  What is the content model of top-element?

In case of BODY it doesn't matter much because BODY is just a tag  
soup. But if, e.g., you wanted a file with the stuff the goes into  
HEAD, except for the title (it is specified some where else, say).  
Like <link>, <meta> etc. Only one TITLE is allowed in HEAD. If the  
parser had parsed one TITLE it wouldn't allow another one. In this  
case "TITLE" would be an HAS-SEEN-ELEMENT.

//Lennart


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV