RE: (dsssl) siblings

Subject: RE: (dsssl) siblings
From: DPawson@xxxxxxxxxxx
Date: Wed, 27 Feb 2002 08:22:19 -0000
(define (siblings #!optional (osnl (current-node)))
  (children (parent osnl)))
>From the procs library.

>    Perhaps the count of 13 includes character nodes for the whitespace
> within the <sect3>?  Not having the DTD you used, 

Ah! Being nearly fully xml'ised, I didn't have a dtd.
So I guess the whitespace nodes are the culprit.

Also missed the fact that self is a sibling of self!

Must be more careful, I still have the xml document 
tree in my head. And boy, are the axis useful :-)

Thanks Brandon.

Regards DaveP

> > <doc>
> > <sect1 id="sect1id">
> >      <head>This is a heading</head>
> >      <p>This is text</p>
> >      <p>This is <em>bold</em></p>
> >      <p>This is <strong>strong</strong></p>
> >      <sect2 id="sect2id" att2="sect2attrib">
> >        <head>Section 2 heading</head>
> >        <p>Another paragraph  <anchor 
> id="anchid">content</anchor></p>
> >       <sect3><head>Section 3 heading</head>
> > 	<special id="spec">Content in section 3</special>
> >        </sect3>
> >      </sect2>
> >    </sect1>
> > </doc>
> > 
> > For element special:
> >   (literal "Siblings: " ( number->string (node-list-length 
> (siblings))))
> > 
> > shows a count of 13, which simply doesn't make sense to me.
> >  From the spec
> > 4.29 siblings (of a node)
> > The other nodes in the grove that occur in the value of the 
> > origin-to-subnode relationship property of the origin of the node.
> > 
> > I interpret this as being the 'depth in the tree' relationship,
> > according to which the sibling count should be 0.
> > 
> Hi, Dave...
>    First of all, how do you have (siblings) defined?  Using the
> definition from the copy of the DSSSL procedure library you have on
> your site, I get a value of 2 for the "special" element, which looks
> correct, as that definition returns the element itself along with the
> element's siblings, so it is counting the <head> and <special>
> elements.
>    Perhaps the count of 13 includes character nodes for the whitespace
> within the <sect3>?  Not having the DTD you used, I may have gotten
> different results.  Try replacing the (literal "Siblings: " ...) line
> you have with (debug-nl (siblings)).  Here's (debug-nl):
> (define (debug-nl #!optional (nl (current-node)))
>   (let loop ((n nl) (r (literal "Node-list:" cr)))
>     (if (node-list-empty? n) r
>         (loop (node-list-rest n)
>               (sosofo-append r
>               (let* ((nd (node-list-first n)) (c 
> (node-property 'classnm nd)))
>                 (cond
>                   ((equal? 'element   c) (literal "Element: " 
> (gi nd) cr))
>                   ((equal? 'data-char c)
>                    (literal "Char:    |"
>                             (string (node-property 'char nd)) "|" cr))
>                   (else (literal "Node:    " (symbol->string 
> c) cr)))))))))
>    This will give you a listing of what's returned from (siblings).
> More detail could, of course, be added to what it generates.
> -Brandon :)
>  DSSSList info and archive:


NOTICE: The information contained in this email and any attachments is 
confidential and may be legally privileged. If you are not the 
intended recipient you are hereby notified that you must not use, 
disclose, distribute, copy, print or rely on this email's content. If 
you are not the intended recipient, please notify the sender 
immediately and then delete the email and any attachments from your 

RNIB has made strenuous efforts to ensure that emails and any 
attachments generated by its staff are free from viruses. However, it 
cannot accept any responsibility for any viruses which are 
transmitted. We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email 
and any attachments are those of the author and do not necessarily 
represent those of RNIB.

RNIB Registered Charity Number: 226227


14th June 2002 is RNIB Look Loud Day - visit to
find out all about it.

 DSSSList info and archive:

Current Thread