RE: process-node-list, select-element, etc.....

Subject: RE: process-node-list, select-element, etc.....
From: "Reynolds, Gregg" <greynolds@xxxxxxxxxxxxxx>
Date: Mon, 18 May 1998 17:29:59 -0500
I don't think (descendants (current-node) will work in a
root-construction-rule.  Try moving your construction rule to the test
element.  You could actually put it anywhere and then select on
(descendants (ancestor "test" (current-node))); at least I think that's
the syntax, it's been a while since I looked.

Here's my understanding of what's going on.  You'll see at the end
there's something I'm not clear on; I hope somebody who really knows
this stuff can set me straight.

"The descendants of a node are defined to be the subtrees of the
children of the node." (p 140).  The root-construction-rule "(root ...)"
matches any node of class "sgml-document".  (p 176, prod [172]).  The
sgml-document node, although it has many nodal properties, has no
children and therefore no descendants.  For a class of node to have
children, it must have a "conprop" property as part of its class
definition (p 77); the "sgmldoc" class definition doesn't define such a
property.  I think that's because it represents the entire sgml
document, the sgml declaration and the dtd as well as the document
instance.  By contrast, the "element" class shows (p. 91)
"conprop=content", which means we can expect element nodes to have a
property whose name is content, which is indeed the case.  The
"datachar" class has "conprop=char", and has a property whose name is
"char".

So if the sgmldoc doesn't have any children, how do we get from there to
the content tree?  Well, the sgmldoc node does have a "docelem"
property, which is a nodal property whose value must be of type
"element".  (In the text of the SGML standard, an "sgml document" is
defined to consist of the sgml declaration, the prolog, and the document
instance set.  The document instance set is a document element, which is
an element.)  If my interpretation is correct, we should be able to get
the docelem property from the sgmldoc node; the docelem node is of type
"element"; it should be the root of the content tree.  But I haven't
tested this.  

But in order for construction rules to work, I think DSSSL must cheat a
little bit here, but I may be imagining this.  I vaguely recall seeing
somewhere in the spec mention of how this happens for the purpose of
flow-object tree construction, but now I can't find it.  In any case the
standard must somehow treat the docelem as the child of the sgmldoc,
even though it isn't explicitly defined as such.  

Sounds kinda convincing, doesn't it?  I thought so, but I just looked at
p. 175 (section 12.4.1) and found that the result returned by the
default construction-rule shall depend on the type of node to which it
is applied: "for a node of class sgml-document, it shall return
(process-children)".  But of course nodes of that type don't have
children.  A related ambiguity occurs on p 174: "A flow object tree is
constructed from a source grove by processing the root node of the
source grove...".  I would think this refers to the tree-root of the
content tree, not the grove-root of the entire grove.  But now I'm not
so sure.


> -----Original Message-----
> From:	Pursel, Frank [SMTP:frank_pursel@xxxxxxxxx]
> Sent:	Monday, May 18, 1998 3:40 PM
> To:	dsssl
> Subject:	process-node-list, select-element, etc.....
> 
> I am using Jade with Linux and trying to extract all the 'notes' from
> this
> document.
> The notes are presumably so important that they must be collected at
> the
> beginning of the printout as special notificaiton.   The remainder of
> the
> document should follow and
> print out normally.  ( I intentionally left out a 'process-children'
> line
> for simplicity here.)
> 
> This dsssl file doesn't seem to do the job.  I suspect I have a gross
> conceptual error about
> how node-list processing is supposed to work, but I need this plank
> picked
> from my eye.  Can
> anyone give me some error correction here?
> 
> <!doctype test [
> <!element test - - (act+)>
> <!element act - - (note | step)+>
> <!element step - - (#PCDATA)>
> <!element note - - (#PCDATA)>
> ]>
> <test>
> <act>
> <step>First step</step>
> <note>1 important note</note>
> </act>
> <act>
> <step>First step again</step>
> <note>note 2</note>
> <step>act 2 step 2</step>
> </act>
> <act>
> <note>note 3</note>
> </act>
> </test>
> 
>  -------Here is the corresponding dsssl file--------
> <!doctype style-sheet PUBLIC "-//James Clark//DTD DSSSL Style
> Sheet//EN">
> 
> (root (process-node-list
>            (select-elements (descendants (current-node)) 'NOTE)))
> 
> (element test (make simple-page-sequence))
> (element act (make sequence (make rule) (process-children)))
> (element step (make paragraph))
> (element note (make paragraph))
> 
>  --------End of files-------------------------
> 
> My eternal, for me at least, gratitude to the brave responders.
> 
> 
>  DSSSList info and archive:
> http://www.mulberrytech.com/dsssl/dssslist


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


Current Thread
  • process-node-list, select-element, etc.....
    • Pursel, Frank - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id QAA12860Mon, 18 May 1998 16:51:55 -0400 (EDT)
      • <Possible follow-ups>
      • Reynolds, Gregg - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id SAA15030Mon, 18 May 1998 18:34:38 -0400 (EDT) <=
        • Frank Pursel - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id IAA29846Tue, 19 May 1998 08:43:48 -0400 (EDT)
          • Tony Graham - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id LAA02911Tue, 19 May 1998 11:32:04 -0400 (EDT)
          • Paul Prescod - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id NAA04875Tue, 19 May 1998 13:13:31 -0400 (EDT)