Microsoft Word 2003: WordProcessingML Transform Inference Tool


OK- things are getting really exciting in the Word development universe. I am really happy to announce that we have published the WordProcessingML Transform Inference Tool. What good is it? Let me give you a scenario. Say you have a bunch of XML files that get pumped out of system <fill_in_the_blank> every day. You often have to do a lot of busy work to take the data, copy/paste it into a Word document and then do some formatting. It's tedious, but Word is the the best place for people in your organization to work with the information, collaborate around it, etc.

Obviously, WordProcessingML is great because you can run a transform agains the XML data files and get nicely formatted Word docs to send out to information consumers. But, what should the transform look like? How should you structure it? To be sure, there is no replacement for cracking open a good text on XSLT and getting up to speed on it, especially when you want to do advanced things. However, the Inference Tool lets you create a "seed" document in Word where you load one of the raw XML data files into a doc and format it to your liking. You save the Word doc as an XML document marked up with WordProcessingML. Then, you run the tool against your saved file to produce the XSLT.

This is a must-have, plain and simple. Big thanks go to the Word product team in Office for making this one happen!

 Rock Thought for the day: I know a lot of people felt that U2 abandoned the heart and soul of their music when they released the POP album in 1997. While I can see why they may draw this conclusion, I have never really agreed. I liked the album then, although I thought the tour was ill-conceived in some respects. As time passed, I found myself listening to the album more and more, recognizing how much it was informed by their punk roots, their ironic self-critique and so much more. I think the album holds up well and is essential in a rock collection. This is an album where no band but U2 could do these songs. It is impossible to think of a good covers for these.

Rock on

Comments (7)

  1. max says:

    It would be nice to have an option to generate the XPath selectors without the positioning argument for text-only elements. This makes sense for documents where you want to occur the same xml values multiple times (but obviously is no good idea for xml data with mixed elements).

    Eventually you can achieve the same result by copying these nodes over and over (see xslt below) before you apply the wml2xsl generated stylesheet – but thats a really bad hack.

    <?xml version="1.0" encoding="UTF-8" ?>

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;

    <xsl:output method="xml"/>

    <xsl:preserve-space elements="*"/>

    <xsl:template match="*[count(text())>0]">

    <xsl:copy-of select="."/>

    <xsl:copy-of select="."/>

    <xsl:copy-of select="."/>

    <xsl:copy-of select="."/>

    <xsl:copy-of select="."/>

    </xsl:template>

    <xsl:template match="node()">

    <xsl:copy><xsl:apply-templates/></xsl:copy>

    </xsl:template>

    </xsl:stylesheet>

  2. When using inference tool generated xslt files as print views in InfoPath, I get errors. Is there any way to use these generated xslt files within InfoPath as Word Print Views? If so, what manual manipulation might be required?

  3. julie says:

    I’ve been using this tool for months now and would like the same ability as Max. I’m using XML/XSL in Word primarily to push data in as it is faster than anything else I’ve tried… I reuse elements all the time. Currently, once I push a document through the processor I then run a VS macro I created to remove all the place references (i.e., myelement[1] to myelement). Other than that and the fact that it doesn’t persist bookmarks or other annotations and sometimes removed styles that aren’t in use (but I haven’t been able to make heads or tails of this yet — when it does and when it doesn’t), it rocks. It does persist VSTO assembly references which is also a very cool thing.

Skip to main content