title: Retrieving data from Excel XML using XSLT
body: <p>I have an excel as follows which has header data in 5th row.</p>
  
  <p><a href="https://i.stack.imgur.com/l4T5Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l4T5Z.png" alt="enter image description here"></a></p>
  
  <p><strong>EDIT :</strong></p>
  
  <p>The input excel may also appear as follows. The data may appear in any column. The data has to be identified using the row headers Ad Name, UID and Status.It wont change.</p>
  
  <p><a href="https://i.stack.imgur.com/NTrdo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NTrdo.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/01Vfd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/01Vfd.png" alt="enter image description here"></a></p>
  
  <p>Which then saved as an work book xml as follows</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;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"&gt;
   &lt;DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"&gt;
    &lt;Author&gt;Jefferson D&lt;/Author&gt;
    &lt;LastAuthor&gt;Jefferson D&lt;/LastAuthor&gt;
    &lt;Created&gt;2015-10-29T17:10:31Z&lt;/Created&gt;
    &lt;LastSaved&gt;2015-10-29T17:15:02Z&lt;/LastSaved&gt;
    &lt;Company&gt;*CL&lt;/Company&gt;
    &lt;Version&gt;12.0&lt;/Version&gt;
   &lt;/DocumentProperties&gt;
   &lt;OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"&gt;
    &lt;AllowPNG/&gt;
   &lt;/OfficeDocumentSettings&gt;
   &lt;ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"&gt;
    &lt;WindowHeight&gt;22060&lt;/WindowHeight&gt;
    &lt;WindowWidth&gt;34400&lt;/WindowWidth&gt;
    &lt;WindowTopX&gt;-20&lt;/WindowTopX&gt;
    &lt;WindowTopY&gt;-20&lt;/WindowTopY&gt;
    &lt;Date1904/&gt;
    &lt;ProtectStructure&gt;False&lt;/ProtectStructure&gt;
    &lt;ProtectWindows&gt;False&lt;/ProtectWindows&gt;
   &lt;/ExcelWorkbook&gt;
   &lt;Styles&gt;
    &lt;Style ss:ID="Default" ss:Name="Normal"&gt;
     &lt;Alignment ss:Vertical="Bottom"/&gt;
     &lt;Borders/&gt;
     &lt;Font ss:FontName="Verdana"/&gt;
     &lt;Interior/&gt;
     &lt;NumberFormat/&gt;
     &lt;Protection/&gt;
    &lt;/Style&gt;
    &lt;Style ss:ID="s16"&gt;
     &lt;Font ss:FontName="Verdana" ss:Bold="1"/&gt;
    &lt;/Style&gt;
   &lt;/Styles&gt;
   &lt;Worksheet ss:Name="Sheet1"&gt;
    &lt;Table ss:ExpandedColumnCount="3" ss:ExpandedRowCount="10" x:FullColumns="1"
     x:FullRows="1"&gt;
     &lt;Column ss:AutoFitWidth="0" ss:Width="176.0"/&gt;
     &lt;Column ss:AutoFitWidth="0" ss:Width="141.0"/&gt;
     &lt;Column ss:AutoFitWidth="0" ss:Width="152.0"/&gt;
     &lt;Row&gt;
      &lt;Cell ss:Index="2" ss:StyleID="s16"&gt;&lt;Data ss:Type="String"&gt;Ad Report&lt;/Data&gt;&lt;/Cell&gt;
     &lt;/Row&gt;
     &lt;Row ss:Index="3"&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;IssueNo: 1&lt;/Data&gt;&lt;/Cell&gt;
     &lt;/Row&gt;
     &lt;Row&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;IssueName: XXX&lt;/Data&gt;&lt;/Cell&gt;
     &lt;/Row&gt;
     &lt;Row&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;Issue Date: YYY&lt;/Data&gt;&lt;/Cell&gt;
     &lt;/Row&gt;
     &lt;Row ss:StyleID="s16"&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;Ad Name&lt;/Data&gt;&lt;/Cell&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;UID&lt;/Data&gt;&lt;/Cell&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;Status&lt;/Data&gt;&lt;/Cell&gt;
     &lt;/Row&gt;
     &lt;Row&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;WWW&lt;/Data&gt;&lt;/Cell&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;0A1&lt;/Data&gt;&lt;/Cell&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;active&lt;/Data&gt;&lt;/Cell&gt;
     &lt;/Row&gt;
     &lt;Row&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;XXX&lt;/Data&gt;&lt;/Cell&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;1B2&lt;/Data&gt;&lt;/Cell&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;active&lt;/Data&gt;&lt;/Cell&gt;
     &lt;/Row&gt;
     &lt;Row&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;YYY&lt;/Data&gt;&lt;/Cell&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;2C3&lt;/Data&gt;&lt;/Cell&gt;
      &lt;Cell&gt;&lt;Data ss:Type="String"&gt;inactive&lt;/Data&gt;&lt;/Cell&gt;
     &lt;/Row&gt;
    &lt;/Table&gt;
    &lt;WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"&gt;
     &lt;Print&gt;
      &lt;ValidPrinterInfo/&gt;
      &lt;PaperSizeIndex&gt;10&lt;/PaperSizeIndex&gt;
      &lt;HorizontalResolution&gt;-4&lt;/HorizontalResolution&gt;
      &lt;VerticalResolution&gt;-4&lt;/VerticalResolution&gt;
     &lt;/Print&gt;
     &lt;ShowPageLayoutZoom/&gt;
     &lt;PageLayoutZoom&gt;100&lt;/PageLayoutZoom&gt;
     &lt;Selected/&gt;
     &lt;Panes&gt;
      &lt;Pane&gt;
       &lt;Number&gt;3&lt;/Number&gt;
       &lt;ActiveRow&gt;13&lt;/ActiveRow&gt;
       &lt;ActiveCol&gt;2&lt;/ActiveCol&gt;
      &lt;/Pane&gt;
     &lt;/Panes&gt;
     &lt;ProtectObjects&gt;False&lt;/ProtectObjects&gt;
     &lt;ProtectScenarios&gt;False&lt;/ProtectScenarios&gt;
    &lt;/WorksheetOptions&gt;
   &lt;/Worksheet&gt;
  &lt;/Workbook&gt;
  </code></pre>
  
  <p>I would like to extract some data from Excel xml file using <strong>XSLT2.0</strong> and want to create a new xml as follows</p>
  
  <pre><code>&lt;adverts&gt;
     &lt;advert&gt;
        &lt;advertName&gt;WWW&lt;/advertName&gt;
        &lt;advertNumber&gt;0A1&lt;/advertNumber&gt;
        &lt;advertStatus&gt;active&lt;advertStatus&gt;
     &lt;/advert&gt;
     &lt;advert&gt;
        &lt;advertName&gt;XXX&lt;/advertName&gt;
        &lt;advertNumber&gt;1B2&lt;/advertNumber&gt;
        &lt;advertStatus&gt;active&lt;advertStatus&gt;
     &lt;/advert&gt;
     &lt;advert&gt;
        &lt;advertName&gt;YYY&lt;/advertName&gt;
        &lt;advertNumber&gt;2C3&lt;/advertNumber&gt;
        &lt;advertStatus&gt;inactive&lt;advertStatus&gt;
     &lt;/advert&gt;
  &lt;/adverts&gt;
  </code></pre>
  
  <p>I am greatly confused because this is the first time I am dealing with workbook XML. Any guiding link is also appreciable.</p>