When I run the attached stylesheet on the attached xml using Saxon 9.0B, I get an error message
"Error at xsl:message on line 55 of file:/home/jak09/Workspace/Semantics/data/schemata/adapt.xslt:
XTDE0420: Cannot create an attribute node (rdo:semanticDistortion) whose parent is a document node"
However, when I turn on tracing (-T) it turns out that the error is being raised on line 55 which is
<xsl:message select="'multiply(',$sequence,') =',$result"/>
Commenting out this line removes the error and the stylesheet completes normally.
I think that this must be a bug.