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