Next Up Previous Contents
Next: document-element-from-fsi
Up: Common functions for the Starlink stylesheets
Previous: ref-target-element-list
[ID index][Keyword index]

document-element

Description

Returns the document element of the document containing the given node.

Only the SgmlDocument node class exibits a DocumentElement property, so to find the document element we first have to find the grove root, which we do by examining the grove-root property of the current node. The only node which doesn't have a grove-root property (so that the (node-property) routine will correctly return #f -- ie, it exhibits the property, but with the value #f) is the root node, but in that case, (current-node) returns the grove root directly (this isn't clear from the standard -- see the discussion on `Finding the root element' in the dssslist archive at <http://www.mulberrytech.com/dsssl/dssslist/>).

The subsequent calls to (node-property) default #f if the property is not exhibited by the node. This catches the case where the grove root doesn't have any document-element property, for example if the grove is malformed because it resulted from a call to (sgml-parse) with a non-existent file.

Argument list
node = node-list (Given), optional

this node indicates the grove we want the document element of.

Return value

Type: singleton-node-list

The document element, or #f if not found.


Next Up Previous Contents
Next: document-element-from-fsi
Up: Common functions for the Starlink stylesheets
Previous: ref-target-element-list
[ID index][Keyword index]