On 8/9/2012 4:27 PM, Michael Kay wrote:
Ah, I see now.
I've been spending some time on a project that translates Saxon's
Expression objects into its own AbstractExpression tree, performs
some rewriting, and then outputs this as serialized xquery which can
be recompiled by Saxon. AbstractExpression.toString() produces
valid XQuery. I tested by passing the XQTS through it and evaluating
the result using Saxon - there are a few issues with surrogates and
a couple of other esoteric things I forget at the moment. If
there's interest, I can make this available under an open source
So I think it's clear that the output of toString() is intended
primarily for the human user, and I therefore don't think it's
unreasonable for Saxon to return a representation of the NodeTest
that can only be parsed using XPath 3.0, given that this allows us
to make the namespace URI explicit.
Making toString() on expressions and related classes guarantee to
return a parseable representation of the expression might be
useful, but it's not currently something we attempt.