That doesn't work. When you submit an order XML to OSM, by default it looks for <CreateOrder>, <CreateOrderBySpecification>, <GetOrder>, <CancelOrder>, etc and removes that element. So what OSM processes is only elements that are <CreateOrder>'s children. Hence "declare variable $ord := fn:root(.)/im:Order;" is correct.