xsl-list
[Top] [All Lists]

RE: equivalence of two predicate tests

2003-05-26 22:54:26
  in a book i'm perusing at the moment, there's a discussion of
simple predicates that's a bit confusing, so i just wanted to
verify that the following two expressions were equivalent:

  elt1[elt2/@attr="value"]

  elt1[elt2[(_at_)attr="value"]]

I'll stick my neck out, Robert, and say "yes, they are equivalent"  :-)

Basically, if an elt1 has at least one @attr hanging off one of its elt2
children, that means it has at least one elt2 child with an @attr hanging
off it.

The predicate in the first case tests a set of the @attr attributes of elt2
children, while in the second case it tests a set of elt2 children having
@attr attributes. These sets are obviously different (unless empty) but they
will either both be empty, or they'll both contain at least one node. If a
nodeset is empty then it is converted to the boolean value "false", if not
empty it converts to "true".

There are people on the list with knowledge of the internal workings of some
XSLT processors who could comment on whether there are performance
implications, but I'd be surprised if there were any.


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



<Prev in Thread] Current Thread [Next in Thread>