You say
<element name="1"> => <element name="1"><content /></element>
the example counts this as the same type of element as the ones
without content.
well yes of course because you (and so I) are only grouping on the name
attribute. If you want to consider something else as being a
distinguishing factor then just include it in the test eg
use
concat(@name,':',count(*))
would distinguish nodes based on their name attribute and the number of
children. I suspect that you want a test that is more like deep-equal
(which is a predefined function in xpath2) so perhaps your request
This is a limitation of xslt that I
believe should be fixed in future revisions.
has been granted in Xpath2. If that is the case you probably can't express that as
a single Xpath in Xpath 1 (without using an extension function,) but you
can certainly express it in xslt1 so you can do the grouping, you
probably just can't use the optimisation of using a key as the key index
needs to be expressed as a single xpath. But keys are only an
optimisation feature anything expressable using keys is expressable
without them (just may take longer to run)
of course any xpath extension that allows xpath functions to be defined
using xslt would allow this kind of key to be used even in an xslt1
context (saxon and the exslt project have such function definition
possibilitiesfor xslt1, and they are a standard part of xslt2 draft)
David