Re: default element construction rule

Subject: Re: default element construction rule
From: Gregg Reynolds <greyno@xxxxxxx>
Date: Mon, 13 Apr 1998 22:12:57 -0400
Paul Prescod wrote:
> 
> The default rule is invoked at *every level* in the absenseof anything
> else that matches. 

Yes and no.  Below you'll find a very simple dtd, doc instance and
stylesheet.  If you experiment with commenting out various lines you'll
find that the only way to fire the H2 element-construction rule is to
include a construction rule for its ancestors, **UNLESS** you omit the
default-element-construction-rule.  The relevant passages from the
standard are:

(sect. 12.4.1, p. 174) "A flow object tree is constructed ... by
processing the root node of the source grove ... the flow objects
specified by the resulting sosofo are added as children of the root of
the flow object tree."  (comment: the "resulting sosofo" results from
processing the root node, which may or may not include processing its
children; this is true for all nodes in the grove, AFAIK.)

(p. 175) "In addition to construction rules explicitly specified in
style-language-bodies, there is an implicit-default-construction-rule. 
The default construction rule matches any node in a source grove but is
less specific than any explicitly specified construction-rule". 
(comment: if you include an explicit default construction rule, the
implicit one (which returns, eg, (process-children) for nodes of class
"element") is overridden.  If you don't override it with an explicit
default rule, you get the whole shebang.)

End result:  if you want to include a default-construction-rule and you
also want to fire some rules for nodes within the grove hierarchy, you
must provide a "path" of explicit construction-rules.  The default rule
is indeed invoked for every element on a given level, but only if
processing reaches that level.

Here's the dssslsheet:
<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN"
[
]>
(declare-flow-object-class entity
  "UNREGISTERED::James Clark//Flow Object Class::entity")
(declare-flow-object-class element
  "UNREGISTERED::James Clark//Flow Object Class::element")
(default (empty-sosofo))
(element ROOT
   (make entity     ;;;  comment out this and the next line to see the
results on stdout
      system-id: "foo.dat"
      (process-matching-children "H1" "H2")))
;;;    (process-children)))
;;;(element H1
;;;  (process-children))
(element H2
  (make element 
    gi: "H2"
    (literal "This is an H2 element")))

...and here's the dtd and doc instance:

<!DOCTYPE root [
<?dsssl dft.dsl>
<!ELEMENT root - - (H1)*>
<!ELEMENT H1 - - (H2)*>
<!ELEMENT H2 - - (H3)*>
<!ELEMENT H3 - - (#PCDATA)>
]>

  <root>
    <H1></H1>
    <H1>
      <H2></H2>
    </H1>
    <H1>
      <H2>
	<H3>foo</H3>
	<H3>bar</H3>
      </H2>
    </H1>
  </root>


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


Current Thread
  • Re: default element construction rule, (continued)
    • Chris Maden - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id PAA15608Mon, 16 Mar 1998 15:01:04 -0500 (EST)
    • Reynolds, Gregg - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id PAA15897Mon, 16 Mar 1998 15:06:16 -0500 (EST)
    • stephenng - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id PAA16310Mon, 16 Mar 1998 15:23:46 -0500 (EST)
      • Paul Prescod - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id SAA19639Mon, 16 Mar 1998 18:43:29 -0500 (EST)
        • Gregg Reynolds - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id XAA23031Mon, 16 Mar 1998 23:14:03 -0500 (EST) <=
        • Chris Maden - from mail1.ability.netby web4.ability.net (8.8.5/8.6.12) with ESMTP id KAA07486Tue, 17 Mar 1998 10:58:20 -0500 (EST)