Sooooo. I was hoping someone could provide me exactly what I need to get from the running router and then show me an example of how to run an op script using that input.
The technique I use is to save the output of each of the Junos commands to separate XML files. You can do "<command> | save <filename.xml>". You'll need to modify the files slightly to remove namespace bindings (if I recall correctly). I then load the contents of those files to simulate the interaction with the Junos device. The XSLT function "document()" is used to load arbitrary XML files into SLAX programs.