Retrieving data from Excel XML using XSLT

I have an excel as follows which has header data in 6th row

enter image description here

Which then saved as an work book xml as follows

<?xml version="1.0"?>
<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>Jefferson D</Author>
  <LastAuthor>Jefferson D</LastAuthor>
  <Created>2015-10-29T17:10:31Z</Created>
  <LastSaved>2015-10-29T17:15:02Z</LastSaved>
  <Company>HCL</Company>
  <Version>12.0</Version>
 </DocumentProperties>
 <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
  <AllowPNG/>
 </OfficeDocumentSettings>
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>22060</WindowHeight>
  <WindowWidth>34400</WindowWidth>
  <WindowTopX>-20</WindowTopX>
  <WindowTopY>-20</WindowTopY>
  <Date1904/>
  <ProtectStructure>False</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
 </ExcelWorkbook>
 <Styles>
  <Style ss:ID="Default" ss:Name="Normal">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font ss:FontName="Verdana"/>
   <Interior/>
   <NumberFormat/>
   <Protection/>
  </Style>
  <Style ss:ID="s16">
   <Font ss:FontName="Verdana" ss:Bold="1"/>
  </Style>
 </Styles>
 <Worksheet ss:Name="Sheet1">
  <Table ss:ExpandedColumnCount="3" ss:ExpandedRowCount="10" x:FullColumns="1"
   x:FullRows="1">
   <Column ss:AutoFitWidth="0" ss:Width="176.0"/>
   <Column ss:AutoFitWidth="0" ss:Width="141.0"/>
   <Column ss:AutoFitWidth="0" ss:Width="152.0"/>
   <Row>
    <Cell ss:Index="2" ss:StyleID="s16"><Data ss:Type="String">Ad Report</Data></Cell>
   </Row>
   <Row ss:Index="3">
    <Cell><Data ss:Type="String">IssueNo: 1</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">IssueName: XXX</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">Issue Date: YYY</Data></Cell>
   </Row>
   <Row ss:StyleID="s16">
    <Cell><Data ss:Type="String">Ad Name</Data></Cell>
    <Cell><Data ss:Type="String">UID</Data></Cell>
    <Cell><Data ss:Type="String">Stattus</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">WWW</Data></Cell>
    <Cell><Data ss:Type="String">0A1</Data></Cell>
    <Cell><Data ss:Type="String">active</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">XXX</Data></Cell>
    <Cell><Data ss:Type="String">1B2</Data></Cell>
    <Cell><Data ss:Type="String">active</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">YYY</Data></Cell>
    <Cell><Data ss:Type="String">2C3</Data></Cell>
    <Cell><Data ss:Type="String">inactive</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">ZZZ</Data></Cell>
   </Row>
  </Table>
  <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <Print>
    <ValidPrinterInfo/>
    <PaperSizeIndex>10</PaperSizeIndex>
    <HorizontalResolution>-4</HorizontalResolution>
    <VerticalResolution>-4</VerticalResolution>
   </Print>
   <ShowPageLayoutZoom/>
   <PageLayoutZoom>100</PageLayoutZoom>
   <Selected/>
   <Panes>
    <Pane>
     <Number>3</Number>
     <ActiveRow>13</ActiveRow>
     <ActiveCol>2</ActiveCol>
    </Pane>
   </Panes>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
 </Worksheet>
</Workbook>

I would like to extract some data from Excel xml file using XSLT2.0 and want to create a new xml as follows

<adverts>
   <advert>
      <advertName>WWW</advertName>
      <advertNumber>0A1</advertNumber>
      <advertStatus>active<advertStatus>
   </advert>
   <advert>
      <advertName>XXX</advertName>
      <advertNumber>1B2</advertNumber>
      <advertStatus>active<advertStatus>
   </advert>
   <advert>
      <advertName>YYY</advertName>
      <advertNumber>2C3</advertNumber>
      <advertStatus>inactive<advertStatus>
   </advert>
</adverts>

I am greatly confused because this is the first time I am dealing with workbook XML. Any guiding link is also appreciable.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s