|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: equivalence of two predicate tests
> 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[@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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








