- (dolist (statement (template-definition-body definition))
- (call-with-tokens parser (ctm-statement-tokens statement)
- (lambda () (read-statement parser map)))))
+ ;; The parser's Document IRI, Prefixes, registry and Counter stay
+ ;; in the caller. Only lexical source coordinates switch to the
+ ;; definition; nested invocations preserve both source frames.
+ (let ((*source-name* (template-definition-source-name definition))
+ (*source-text* (template-definition-source-text definition)))
+ (dolist (statement (template-definition-body definition))
+ (call-with-tokens parser (ctm-statement-tokens statement)
+ (lambda () (read-statement parser map))))))