This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Can sets have order?


Dimitre Novatchev writes:
 > Wolfgang May wrote:
 > 
 > > Not the same node, yes, but nodes which have the same values for all
 > > their attributes and attributes of subelements (i.e., which are
 > > deep-equal).  Such nodes may be exchanged in the node set without
 > > changing the behavior of any XPath query.

 > I regard the whole notion of "Deep-Equal Nodes" as a misconception:

This notion is not coined by me, "Deep-Equality" is a notion which has
been dealt with since years in object-oriented models.
(cf. @InProceedings{abiteboul-bussche-DOOD-95,
       author = "Serge Abiteboul and Van den Bussche, Jan},
       title = "Deep Equality Revisited",
       crossref = "DOOD-95"}
)

 > 1. It already confused people into thinking that indistinguishable
 > nodes could exist.
 > 
 > 2. Letting such "indistinguishable" pairs of nodes in an xml document
 > has all problems and anomalies of non-normalized data.
 > 
 > 3. This will also lead to artificially increasing the necessary memory
 > and processing time for an XML document.
 > 
 > How to avoid such nodes? Here's one simple way:
 > 
 > <node1 ID="id1">
 >   <!--  Any contents goes here -->
 > </node1>
 > 
 > <node2 RefID="id1"/>

Clearly, this *can* be avoided, but the data model allows for it.

 > Not quite so...
 > 
 > Some XPath expressions (defined on the nodes of a nodeset), in which 
 > position() is combined with some of the following:
 > 
 > count(preceding::node()) 
 >  or 
 > count(following::node()) 
 >  or 
 > count(ancestor::node())
 >  or
 > count(descendant::node())
 > 
 > ... etc.
 > 
 > will be affected by even a single swap of two so called "deep equal"
 > nodes.

as *relative* path expressions starting from an already fixed element,
yes, but a full XPath expression starts at the root node, so you need
a way first to navigate to the element:

 > Any Xpath expression that evaluates to exactly one of the nodes in a
 > "deep equal" pair -- this expression will be different from any Xpath
 > expression that evaluates to the other node.

How should this expression select "exactly one of these nodes"?
Exchange them, and it will evaluate to the other one. How should it be
able to detect if they are exchanged?

If there is no artificial additional attribute, every query on the
result document has the same results if duplicates are exchanged.

Consider a node set X s.t. x1 in X and x2 in X are deep-equal, such that
  x1 in resultSet(//path1[filter])
and
  rs = resultSet(//path1[filter]/path2).

Then if x' is obtained by exchanging X1 and x2 in X,
  x2 in resultSet(//path1[filter])
and   
  resultSet(//path1[filter]/path2) = rs   again.

There is no query which yields visibly different results.

Wolfgang

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]