

Re: Older Sibling?

From: <keshlam@us.ibm.com>
Date: Mon, 28 Feb 2000 18:25:49 -0500
To: David Brownell <david-b@pacbell.net>
cc: Thomas Ashe <Thomas.Ashe@Blackbaud.com>, www-dom@w3.org
Message-ID: <85256893.0080B60F.00@D51MTA03.pok.ibm.com>
>> Given two nodes of a common parent, identify which node precedes the
>> in the parent's ChildNodes nodelist.
>> Is there such a creature in the current specs?
>You'd basically look at the nodelist yourself.  Takes a few lines
>of code -- would you seriously expect DOM to save you the work of
>writing such a simple subroutine?  If so, why?

I've heard one strong case where an ordering query would be useful -- not
on NodeLists, but on lists of nodes generated in other ways.  That case is
XSLT. It's not uncommon there to want to take the union of several
seperately executed searches and present it as a single list of nodes, in
document order. In that situation, convolving the lists to interleave them
correctly can be a significantly expensive operation.

We've had periodic requests from XSLT developers to add a
Node.isBefore(Node) operation, which they could invoke in the hope that a
specific DOM might have an underlying representation which permits
optimizing this operation. Given that some models _can_ answer this
question much more quickly via their internal representations than via
their DOM API, I think it's worth considering.

Statement of bias: I wrote one such model; that fast-ordering feature is
one of several reasons LotusXSL/Xalan prefers to read the input document
from DTM rather than from a "normal" DOM.

Joe Kesselman  / IBM Research
Received on Monday, 28 February 2000 18:30:46 GMT
