I solved the substitution group and duplicate namespace declaration issues.
* The documents I'm generating aren't valid WaterML2 because om:procedure is missing. David Valentine pointed that out too.
* Now that I've got this working, there's a LOT of cruft I can rip out now. I just wanted to do this commit before I started ripping.