[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Excel Spreadsheet problem

Subject: Excel Spreadsheet problem
From: Gustaf Liljegren <gustaf.liljegren@xxxxxx>
Date: Wed, 10 Sep 2003 20:18:39 +0200
xsl excel
I'm trying to get some useful data from an Excel 2003 spreadsheet, saved to
XML. This is what the source file looks like (very much shortened):

<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
 ...
 <Worksheet>
  ...
  <Table>
   ...
   <Row>
    <Cell>
     <Data>ID</Data>
     ...
    </Cell>
    ...
   </Row>
  </Table>
 </Worksheet>
</Workbook>

And this is what I want:

<?xml version="1.0" encoding="iso-8859-1"?>
<table>
  <row>
    <cell>...</cell>
    ...
  </row>
  ...
</table>

Plus a namespace if it's necessary. This is how I tried:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:my="urn:schemas-microsoft-com:office:spreadsheet">

  <xsl:output method="xml" encoding="iso-8859-1" indent="yes"/>

  <!-- Match the first <Table> element -->
  <xsl:template match="my:Table[1]">
    <table>
      <xsl:apply-templates select="my:Row"/>
    </table>
  </xsl:template>

  <xsl:template match="my:Row">
    <row>
      <xsl:apply-templates select="my:Cell"/>
    </row>
  </xsl:template>

  <xsl:template match="my:Cell">
    <cell>
      <xsl:value-of select="my:Data"/>
    </cell>
  </xsl:template>

  <!-- Skip any other elements -->
  <xsl:template match="*"/>

</xsl:stylesheet>

And this is all I get:

<?xml version="1.0" encoding="iso-8859-1"?>

What am I doing wrong?

Gustaf



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.