Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Convert Excel XML to HTML with XSLT

Posted on 2003-10-31
2
Medium Priority
?
1,595 Views
Last Modified: 2013-11-19
I have a small spreadsheet that I would like to publish on out Intranet and make changes to it every now and then.  Here is the XML source:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="versions.xsl"?>
<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">
      <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
            <Author>MIS</Author>
            <LastAuthor>MIS</LastAuthor>
            <Created>2003-10-31T14:52:28Z</Created>
            <Company>Schonfeld Securities, LLC.</Company>
            <Version>10.2625</Version>
      </DocumentProperties>
      <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
            <DownloadComponents/>
            <LocationOfComponents HRef="file:///\\Jer-027\f\"/>
      </OfficeDocumentSettings>
      <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
            <WindowHeight>8580</WindowHeight>
            <WindowWidth>15180</WindowWidth>
            <WindowTopX>120</WindowTopX>
            <WindowTopY>60</WindowTopY>
            <ProtectStructure>False</ProtectStructure>
            <ProtectWindows>False</ProtectWindows>
      </ExcelWorkbook>
      <Styles>
            <Style ss:ID="Default" ss:Name="Normal">
                  <Alignment ss:Vertical="Bottom"/>
                  <Borders/>
                  <Font/>
                  <Interior/>
                  <NumberFormat/>
                  <Protection/>
            </Style>
      </Styles>
      <Worksheet ss:Name="Sheet1">
            <Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="3" x:FullColumns="1" x:FullRows="1">
                  <Column ss:AutoFitWidth="0" ss:Width="62.25"/>
                  <Row>
                        <Cell>
                              <Data ss:Type="String">SchonEx</Data>
                        </Cell>
                        <Cell>
                              <Data ss:Type="String">2.10.10</Data>
                        </Cell>
                  </Row>
                  <Row>
                        <Cell>
                              <Data ss:Type="String">Dotty</Data>
                        </Cell>
                        <Cell>
                              <Data ss:Type="String">1.2.3</Data>
                        </Cell>
                  </Row>
                  <Row>
                        <Cell>
                              <Data ss:Type="String">Schonsite</Data>
                        </Cell>
                        <Cell>
                              <Data ss:Type="String">1.2.4</Data>
                        </Cell>
                  </Row>
            </Table>
            <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
                  <Selected/>
                  <Panes>
                        <Pane>
                              <Number>3</Number>
                              <ActiveRow>2</ActiveRow>
                              <ActiveCol>1</ActiveCol>
                        </Pane>
                  </Panes>
                  <ProtectObjects>False</ProtectObjects>
                  <ProtectScenarios>False</ProtectScenarios>
            </WorksheetOptions>
      </Worksheet>
      <Worksheet ss:Name="Sheet2">
            <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
                  <ProtectObjects>False</ProtectObjects>
                  <ProtectScenarios>False</ProtectScenarios>
            </WorksheetOptions>
      </Worksheet>
      <Worksheet ss:Name="Sheet3">
            <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
                  <ProtectObjects>False</ProtectObjects>
                  <ProtectScenarios>False</ProtectScenarios>
            </WorksheetOptions>
      </Worksheet>
</Workbook>


++++++++++++++++++++++++++++++++++++++++++++++++++++

Here is the XSL I am using to process it (not working so far):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <xsl:output method="html"/>
      <xsl:template match="/">
      <html>
            <head>
                  <title>Software Versions</title>
            </head>
      <body>

Versions: <br/>
      <xsl:for-each select="Workbook/Worksheet/Table/Row/Cell">
            <xsl:value-of select="Data" />
            <br/>
      </xsl:for-each>
      <br/>
-- end --
</body>
      </html>

</xsl:template>
</xsl:stylesheet>
0
Comment
Question by:AlexNYC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Expert Comment

by:rishisk
ID: 9661456
Replace the Workbook start tag as follows

<Workbook xmlns="" 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">

It worked with IE 6.0

Hope it helps.
0
 
LVL 2

Accepted Solution

by:
ericsDev earned 500 total points
ID: 9669051
this should work for you, copy and paste over your current XSL and then apply to your existing Excel XML file, I tested it on the posted data above:

XSL : ms_excel.xsl
-----------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ericsDev="urn:schemas-microsoft-com:office:spreadsheet" version="1.0">
      <xsl:output method="html" />
      <xsl:template match="/">
            <html>
                  <head>
                        <title>AlexNYC's solution</title>
                  </head>
                  <body>
                        Versions:
                        <br />
                        <xsl:for-each select="ericsDev:Workbook/ericsDev:Worksheet/ericsDev:Table/ericsDev:Row/ericsDev:Cell">
                              <xsl:value-of select="ericsDev:Data"/>
                              <br/>
                        </xsl:for-each>
                        <br />
                        -- end --
                  </body>
            </html>
      </xsl:template>
</xsl:stylesheet>
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question