topical media & game development

talk show tell print

professional-xml-25-Word-SimpleWord.xsl / xsl



  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="2.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:fo="http://www.w3.org/1999/XSL/Format" 
   xmlns:xs="http://www.w3.org/2001/XMLSchema" 
   xmlns:fn="http://www.w3.org/2005/xpath-functions" 
   xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" 
   xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" 
   xmlns:o="urn:schemas-microsoft-com:office:office">
  <xsl:output encoding="UTF-8" standalone="omit" method="html"  indent="yes" />
          <xsl:template match="/">
                  <html>
                          <head>
                                  <title>
                                          <xsl:value-of select="/w:wordDocument/o:DocumentProperties/o:Title"/>
                                  </title>
                          </head>
                          <body>
                                  <xsl:apply-templates select="/w:wordDocument/w:body"/>
                          </body>
                  </html>
          </xsl:template>
          <xsl:template match="w:p">
                  <div>
                          <xsl:if test="exists(w:pPr)">
                                  <xsl:attribute name="class"><xsl:value-of select="w:pPr/w:pStyle/@w:val"/></xsl:attribute>
                          </xsl:if>
                          <xsl:value-of select="w:r/w:t"/>
                  </div>
          </xsl:template>
  </xsl:stylesheet>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.