RE: [XML Schema 1.1] Using doc() in xs:assert ... the referenced document needs a schema?

> I'm not clear on (b) but (a) certainly sounds like the 
> decision to disallow doc() for cross-document validation was 
> done to make it easier to implement 1.1 schema validators. 

No, I don't think that's the case. I think the working group felt that
introducing context-dependent validation (where the validity of a document
depends on factors other than the schema and the instance document) was a
risky architectural innovation, and possibly a step that would be later
regretted. I don't think implementation factors came into it once the
decision was made to support the full XPath syntax and function library. I
discovered when I tried to do it that implementation was trickier than I
thought, but it's not difficult, and certainly I don't think the WG avoided
it for that reason.

Personally, I would like to experiment/innovate with context-dependent
validation, for example by allowing assertions to reference XPath variables
supplied when the validation is invoked; perhaps even variables that can be
bound while validating an ancestor element. I think it could be a very
powerful feature - though I'm sure users would use it in ways I can't
currently imagine.

Michael Kay
http://www.saxonica.com/

Received on Monday, 27 April 2009 16:21:02 UTC