Derek Smyth
Hi,
I'm glad that worked out for you. This is the first time I've seen this problem but I've generally kept the xml declaration in the XML files; I believe the declaration contains important information about the file.
The xml that your transformation creates should follow the stylesheet output options. If you just wrote the XML to file using a FileStream in the transformation then I don't think you'd have had the declaration. Since the XmlWriter was used it placed it's own declaration in, it would be interesting to see what would happen if the transformed xml had a declaration, would the XmlWriter write another one
If you add a break point and watch on your StringBuilder you should be able to check what XML is being produced by your stylesheet.
The other thing is with both encoding and omit-declaration settings used there could be a conflict. The declaration contains the encoding so perhaps the encoding setting takes precedence over the other. So regardless of the omit-declaration setting maybe if encoding is set a declaration is automatically written. Unfortunately I don't know if this is true but the way to find out would be to check the string held in your StringBuilder after the transformation.
Hopefully that was helpful.