Posted By

rengber on 02/19/08


Tagged

xslt xml excel MSOffice


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

apawson
kaartz
Tyster


XSLT to Pull Data out of an Excel XML Spreadsheet


 / Published in: XML
 

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method="html" />
  4. <xsl:variable name="title" select="/Workbook/Worksheet/@Name"/>
  5. <xsl:template match="/">
  6. <html><head><title>Leisure Timetable</title></head>
  7. <body>
  8. <h1><xsl:value-of select="$title"/></h1>
  9. <xsl:apply-templates select="Workbook/Worksheet"/>
  10. </body>
  11. </html>
  12. </xsl:template>
  13.  
  14. <xsl:template match="Worksheet">
  15. <xsl:apply-templates select="Table"/>
  16. </xsl:template>
  17.  
  18. <xsl:template match="Table">
  19. <table border="1">
  20. <xsl:apply-templates select="Row"/>
  21. </table>
  22. </xsl:template>
  23.  
  24. <xsl:template match="Row">
  25. <tr>
  26. <xsl:for-each select="Cell">
  27. <td><xsl:value-of select="." /></td>
  28. </xsl:for-each>
  29. </tr>
  30. </xsl:template>
  31.  
  32. </xsl:stylesheet>

Report this snippet  

You need to login to post a comment.