Skip to content

Instantly share code, notes, and snippets.

@ryanjdew
Created June 14, 2012 13:30
Show Gist options
  • Select an option

  • Save ryanjdew/2930293 to your computer and use it in GitHub Desktop.

Select an option

Save ryanjdew/2930293 to your computer and use it in GitHub Desktop.
In Memory Advanced Transform Statements, Example 2
(:
let $oldx := /a/b/x
return
copy $newx := $oldx
modify (rename node $newx as "newx",
replace value of node $newx with $newx * 2)
return ($oldx, $newx)
=>
:)
let $oldx := /a/b/x
return
($oldx,
mem:copy($oldx),
mem:rename($oldx, fn:QName("","newx")),
mem:replace-value($oldx, $oldx * 5),
mem:execute())
(:
=>
(<x>...</x>,<newx>...</newx>)
:)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment