Hi, When experimenting with my RBaseX-package (I had hoped to submit it to CRAN today), I use the following pattern: 1 Define a query 2 Create a query-object 3 Bind variables (optional) 4 Execute the query When used this pattern on the following query, everything functions as expected: declare variable $name external; for $i in 1 to 3 return element { $name } { $i } The following query is also functioning: paste("declare variable $greet external;", "declare variable $friend external;", "declare variable $into external;", "let $greet := 'Greetings, my '", "let $friend := 'friend'", "for $i in 1 to 3", "let $friend_num := $greet || $friend || $i", "return insert nodes element { $friend } { $friend_num }", "into root", sep = " ") When I modify "into root" to "into $p" and bind $p to root Bind(query_obj, "$p", "root") I get the following error: [XPST0008] Undeclared variable $p The Bind-function returns with code \00, indicating that it is executed without errors. Does this mean that there is a bug in my code or am I violating XQuery-syntax? Ben Engbers