[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Universally quantified test of child attribute pr
the simplest way of negating an expression is to put not around it so if every $child in * satisfies $child[@my_attribute] is the positive test not(every $child in * satisfies $child[@my_attribute]) is the negative test, and if that's the simplest for you to grock later than that's what I'd use. Personally I'd have probably written the "positive test" in negative form, rather than saying every chiuld has teh attribute, say no child doesn't have the attribute not(*[not(@my_attribute)]) which is also valid xpath 1 of course. This would make your "negative" test exists(*[not(@my_attribute)] Your other two expressions are valid but mean something else. every $child in * satisfies $child[not(@my_attribute)] every $child in * satisfies not($child/@my_attribute) are true if every element does not have the attribute. However none of the tests seem to capture what you say in english > all of its element children carry a specific attribute or if they don't. A > mixed situation is to be considered as a fatal error, caught in an > xsl:otherwise clause. the tests you show test that all the elements have or dont have the attribute, but only test for one or the other, they don't test for the mixed case. The most direct test for the mixed test is just to test test="*[@my_attribute] and *[not(@my_attribute)]" David
|
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
|