Search code examples
xmlxsltms-officeword-2007wordml

Accessing Properties of an xml file in Word 2007


I am writing style sheet for MS Word 2007 and I want to add a template using < xsl : template > element which accesses Properties of Word 2007 document. (Template, TotalTime, etc.) Can someone provide me with the code to start this?


Solution

  • At the stylesheet level, declare the namespaces prefixes you wish to use for namespaces in the Word 2007 Flat OPC XML:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
        xmlns:ep="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
        xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage"
        xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
    

    To remove the <Template> extended property (from what would be app.xml in a zipped up docx):

    <xsl:template match="ep:Template" />