Re: [xsl] Universally quantified test of child attribute presence/absence

Subject: Re: [xsl] Universally quantified test of child attribute presence/absence
From: Yves Forkl <Y.Forkl@xxxxxx>
Date: Tue, 20 Mar 2007 14:38:21 +0100
David Carlisle wrote:
[Yves wrote]: Thank you very much for this hint - I actually need a
test that returns true if all children carry the attribute AND if there are element children at all [...]

there are always many ways of phrasing these things. [...]


for example to write the xpath to match the english above you could write

(every $c in * satisfies $c[@attribute]) and *

although a more compact way to say that in english is to say no child
 exists which does not have the attribute, or in xpath

not(*[not(@attribute)])

But these expressions are not equivalent, since the second returns True in absence of any element children, whereas the first of course returns False (speaking from the experience of testing these two, not by knowledge of the specs). So I suppose I will have to require the presence of child elements explicitly like in the first expression above, but that's no big deal.


Yves

Current Thread