Subject: Re: [xsl] Universally quantified test of child attribute presence/absence From: Yves Forkl <Y.Forkl@xxxxxx> Date: Tue, 20 Mar 2007 14:07:49 +0100 |
The expression:
empty(*/@my_attribute)
will return true() when there is no child that has an attribute @my_attribute (i.e., in other words, it will return true when the expression returns an empty sequence).
The expression:
every $child in * satisfies $child/@my_attribute
may not return the expected answer when there are no childs at all: it will return true. [...]
> 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)]
> 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)]"
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Universally quantified te, Abel Braaksma | Thread | Re: [xsl] Universally quantified te, David Carlisle |
Re: [xsl] Universally quantified te, Abel Braaksma | Date | Re: [xsl] Universally quantified te, David Carlisle |
Month |