|
|||||
|
|||||
Related Syntax | Related Concepts | ||||
built-in variable |
#doctype |
Purpose
A pre-defined stream shelf that provides the name of the document element. #doctype
is especially useful when the
name of the document is required outside of the instance; in particular, when processing the external identifier at the start of the DTD.
#doctype
is "attached" as soon as OmniMark encounters the document element name at the start of the DTD, following the doctype keyword. Prior to this, #doctype
is "unattached". Specifically, it is never attached in the following:
document-start
rule.
do xml-parse
or do sgml-parse
block prior to the parse continuation operator (%c
or suppress
), unless a pre-compiled DTD is used.
The stream #doctype is attached
test can be used to determine whether the document element name is available.
#doctype
must not be accessed in process
, process-start
, or process-end
rules.
As a read-only stream, #doctype
may be passed only as a read-only argument; it cannot be modified, added to, or cleared.
The following example shows how to use the name of the document element to find an external entity when the external identifier at the head of the DTD has no public or system identifier (for example, !DOCTYPE doc SYSTEM [
). For example, say the file "doc.dtd" is intended to be used. The name of the document element would be available to the OmniMark program in the #doctype
stream.
external-text-entity #dtd when entity isnt (system | public) output file "%lg(#doctype).dtd"
Related Syntax #appinfo dtd-end |
Related Concepts XML/SGML parsing: built-in shelves |
Copyright © Stilo International plc, 1988-2008.