Hi,

Given the following xquery:
import module namespace functx = "http://www.functx.com" at "http://www.xqueryfunctions.com/xq/functx-1.0-nodoc-2007-01.xq";
declare variable $entryid_prefix as xs:string external;
declare variable $src_prefix as xs:string external;
declare variable $other_src_prefix as xs:string external;

let $feeds_metadoc := 
  <feed>
    <entry>
      <id>1</id>
      <child src='2' />
      <child src='libx.org@gmail.com/core' />
    </entry>
  </feed>
    
return(
  copy $feed_copy := $feeds_metadoc
    modify (
      for $entry in $feed_copy/entry
        return (
          for $entry_id in $entry/id
            where fn:not(fn:contains($entry_id, '/'))
              return replace value of node $entry_id with concat($entryid_prefix, $entry_id)
          for $src in $entry/child/@src
            return (
              if (fn:contains(data($src), '/'))
              then (
                let $src_id_new := concat($other_srcprefix, $src_id)
                return replace value of node $src with $src_id_new
              )
              else (
                let $src_data := concat($src_prefix, data($src))
                return replace value of node $src with $src_data
              )
            )
        )
    )
  return $feed_copy
)

Say, the values are passed are - $entryid_prefix = 'http://X/", $src_prefix="http://Y/", and $other_src_prefix="http://Z/". After running the above xqueries by passing these values, I expect the output to be:

 <feed>
    <entry>
      <id>http://X/1</id>
      <child src='http://Y/2' />
      <child src='http://Z/libx.org@gmail.com/core' />
    </entry>
  </feed>

I am trying to use multiple for statements within the modify statement and this does not work. I see the following error:
java.io.IOException: Stopped at line 23, column 10:
[XPST0003] Expecting ")", found "f".

I highlighted line 23 for convenience. Please help me fix this. 

Thanks,
Sony