xslt导入excel

来源:互联网 发布:通话声音分析软件 编辑:程序博客网 时间:2024/06/14 15:58
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 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">
  <xsl:template match="/">
        <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet">
            <Worksheet ss:Name="driver">
              <Table  ss:DefaultColumnWidth="60" ss:DefaultRowHeight="15">
                    <Row>
                        <Cell><Data ss:Type="String">编号</Data></Cell>
                        <Cell><Data ss:Type="String">姓名</Data></Cell>
                        <Cell><Data ss:Type="String">性别</Data></Cell>
                        <Cell><Data ss:Type="String">单位</Data></Cell>
                        <Cell><Data ss:Type="String">固定电话</Data></Cell>
                        <Cell><Data ss:Type="String">手机</Data></Cell>
                    </Row>
                     <xsl:apply-templates />
              </Table>
         </Worksheet>
        </Workbook>
  </xsl:template>

    <xsl:template match="Row">
         <Row xmlns="urn:schemas-microsoft-com:office:spreadsheet">
            <xsl:for-each select="./*">
                <Cell><Data ss:Type="String"><xsl:value-of select="."/></Data></Cell>
            </xsl:for-each>
         </Row>        
    </xsl:template>
</xsl:stylesheet>