I was recently reviewing some tech comments from the product team for an article we wanted to publish on the Office Developer Center (http://msdn.microsoft.com/office). Among the comments was one about XSL transforms when a document loads in Microsoft Office Word 2003 (yes- that’s the officially branded name!). I wanted to review this comment here, because we do get questions about this behavior in Word 2003. Also, I had not really noticed the behavior in the little demos and so forth I had written, mainly because of the way I ran them.
Here’s how it works: when you open an XML Word document, the XML Data Views task pane opens up. In this pane, you can choose whether you want to see the data of the document only or if you want to apply a transform. If your document has a stylesheet reference, you will see the referenced XSL listed. Optionally, you can browse for a different XSL.
Now, here’s the key- if you make a change to the document, the option of choosing an XSL goes away. In other words, choosing an XSL transform can only be done when the document is freshly opened or when you are saving the document. Once you make a change in the document, you lose the “live” xsl transform capability, although you can still apply a transform when you save the document.
Closing an re-opening the XML document will always give you the ability to reapply a transform, you just can’t reapply while a document is being modified