For the query "PROJECT[1]/PROPOSAL[1]/SOLUTION[1]/UNIT[1]/distinct-values(LANDING_DOOR_FRAME_FINISH_FRONT/LANDING_DOOR_FRAME_FINISH_FRONT_VALUE)" this appears to work if distinct-values() returns exactly one value, but throw an exception otherwise. (And by the way, this query is not my idea).
Is it a bad idea to have an atomic value as a node name in a query? Or is it ok? And if ok, is it ok only if it returns exactly one value?
Calling Saxon from Java for this.
It's a perfectly valid query, whether or not
distinct-values()returns exactly one value.(If it fails, show us a repro: all the data we need to reproduce the problem, plus the error message).
But your question, about using atomic values as node names, suggest that you don't understand what the expression means. The values returned by distinct-values() don't have to be node names, and they are not used as node names.
These days I prefer to use the "!" operator when the RHS expression returns atomic values rather than nodes. It's equivalent, but clearer.