I know we discussed this extensively, and there are notes that the IBM DFDL implementation evaluates a dfdl:length expression when unparsing.
But searching the mail history, the trackers, etc. I cannot find a clear definitive statement of what we finally decided as to whether this is the official behavior or not.
I cannot find language in the DFDL spec that says that the dfdl:length expression is or is not evaluated. (No such problem for dfdl:occursCountKind 'expression'. There we are very clear it is NOT evaluated when unparsing.)
There is this statement in the discussion of dfdl:contentLength function:
"When unparsing with dfdl:lengthKind "explicit",
the calculation of dfdl:contentLength() returns the value of the dfdl:length
property."
It does not say whether this forces the expression (if dfdl:length is an expression) to be evaluated or not, though it implies it must be evaluated because otherwise it would be undefined in that situation.