XSL Transforms and WordML
I was recently reviewing some tech comments from the product team for an article we wanted to publish on the Office Developer Center (https://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
Comments
Anonymous
February 10, 2004
Is there a way with VBA to replly the transform dynamically, like on a button click?Anonymous
February 10, 2004
The comment has been removedAnonymous
February 10, 2004
Granted, and will do. Thanks for the response, Bill.Anonymous
February 10, 2004
Hi Kent,
Another option is to create a Smart Document - if you do that, you can automatically include transforms as part of your code. In our SyntoniX solutions, XML is inserted via the Doc Actions task pane. The code does two things - inserts the proper XML structure at the proper location and applies styles to that new content - either through a transform or through traditional VBA techniques, depending on what's most appropriate.Anonymous
June 08, 2009
PingBack from http://hairgrowthproducts.info/story.php?id=1018Anonymous
June 15, 2009
PingBack from http://debtsolutionsnow.info/story.php?id=10966