Posted By

farmerbuzz on 05/06/09


Tagged

xslt word


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


Extract inline comments from a Word 2007 document using XSLT


 / Published in: XML
 

  1. <![CDATA[
  2. <?xml version="1.0" encoding="utf-8"?>
  3. <xsl:stylesheet version="1.0"
  4. xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
  5. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  6. <xsl:output method="xml" indent="yes" />
  7.  
  8. <!--<xsl:template match="@* | node()">-->
  9. <xsl:template match="/">
  10. <html>
  11. <head>
  12. <link rel="stylesheet" type="text/css" href="BeckmanCoulter_Comments.css"/>
  13. </head>
  14. <body>
  15. <h2>Word Comments<!--: <xsl:value-of select="b:LIS2A2Spec/@name"/>--></h2>
  16. <xsl:for-each select="w:comments/w:comment">
  17. <br />
  18. <xsl:value-of select="./@w:author"/> (<xsl:value-of select="./@w:initials"/>)&#160;&#160;&#160;|&#160;&#160;&#160;<xsl:value-of select="./@w:date"/>
  19. <br />
  20. <xsl:value-of select="."/>
  21. <br />
  22. </xsl:for-each>
  23.  
  24. <br/>
  25. <hr/>
  26. <br/>
  27. </body>
  28. </html>
  29. </xsl:template>
  30. </xsl:stylesheet>
  31. ]]>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: farmerbuzz on May 6, 2009

This XSLT will extract in-line comments from a Word 2007 document and output them in HTML with very basic formatting.

  1. Rename your .docx file to .zip
  2. Extract the .zip file and grab comments.xml from the "word" folder within
  3. Use a program like Xselerator to apply this xslt to comments.xml

You need to login to post a comment.