My XML looks like this:
3&
If all the
baz
children are same thendoSomething
elsedoSomethingElse
. My current node isfoo
.
This is confusing because:
baz
are not children of foo
;Try something like:
Note that this assumes that every baz
has a date
and a time
. Otherwise you need to test for not(date=$first-baz/date)
etc.
See also: http://www.jenitennison.com/xslt/grouping/muenchian.html
Now, assuming all the
bar/baz
elements have the same tags (not necessarilydate
andtime
but saya
,b
andc
), what would be the test attribute for that case?
This makes it significantly more complex. Still you could construct a key:
then make your test:
This returns true if any child of baz
exists whose string-value is different from an equally named node that is child of the first baz
.
Note that the key, as defined here, is document-wide. If you want to restrict the test to the current foo
ancestor, then you must include its id in the key.