> Saxon 9.8 however parses that input fine. Good to know. Saxon-EE 9.7.0.8, still raises an error, so it seems to have been changed more recently. I will see if there are new test cases that cover this case, or if someone has posted something similar on the Saxon bug tracker.
> Looking at https://www.w3.org/TR/xpath-functions-31/#func-xml-to-json there > is some text saying "An element node E having a key attribute and/or an > escaped-key attribute provided that E would satisfy one of the above > conditions if the key and/or escaped-key attributes were removed." which > sounds as if a "key" attribute should or could be ignored. > > Or is BaseX schema-validating the argument and that way ("Otherwise, the > processor may attempt to validate the element against the schema, in which > case it is treated as valid if and only if the outcome of validation is > valid.") the "key" attribute is not allowed? > > It seems the spec that way allows some confusing lack of interoperability. >