XML : improper output in Excel from XML

This morning I was given a .txt file and three .xslt files. The intent was that I was supposed to receive a xml file that I could upload to MS Excel. When I upload the file named "filexml.txt" to excel using either the "From Text" or "From Other Sources" option the output looks like, Sample Output

It should look something like this, Desired Output

The Code for the XML file,

  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>  <?xml-stylesheet type="text/xsl" href=" iGrantsHCPGiftedGender.xslt"?>  <Project>    SchoolDistrict  CountyDistrictCode  FiscalPeriodId  Name    xsltFileName           Data  Aberdeen School District    14005   13  HCP Prog 3 Gender       iGrantsHCPGiftedGender.xslt <District></District>  Aberdeen School District    14005   13  HCP Prog 3 Race iGrantsHCPGiftedRace.xslt   <District></District>  Aberdeen School District    14005   13  HCP Prog 3 Support  iGrantsHCPGiftedSupport.xslt    <District></District>  Aberdeen School District    14005   13  HCP Prog 28 Gender  iGrantsHCPGiftedGender.xslt <District></District>  Aberdeen School District    14005   13  HCP Prog 28 Race    iGrantsHCPGiftedRace.xslt   <District></District>  Aberdeen School District    14005   13  HCP Prog 28 Support iGrantsHCPGiftedSupport.xslt    <District></District>  Aberdeen School District    14005   13  HCP Prog 29 Gender  iGrantsHCPGiftedGender.xslt <District><Grade GradeLevel="10" Gender="Female"     TotalServed="7" /><Grade GradeLevel="10" Gender="Male" TotalServed="8" /><Grade     GradeLevel="10" Gender="TotL1L2"     

And the XSLT file for a portion of iGrantsHCPGiftedGender,

  <?xml version="1.0" encoding="UTF-8" ?>  <!--  Summary: Transforms XML iGrants Bulk Data: State Funded Highly Capable     Program Student Enrollment Data - CEDARS Gifted Value 3, 28, or 29    Breakout by Gender & Grade - located in iGrants database.  -->  <!--  Created: Jason Alvarado 5/20/13 -->  <xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:xs="http://www.w3.org/2001/XMLSchema" >  <xsl:preserve-space elements="*" />  <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>  <xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.0     Transitional//EN"/>        <xsl:variable name="BulkID" select="/District/@BulkID" />  <xsl:variable name="AsOfDate" select="/District/@asofDate" />    <xsl:template match="/District">  <table border="1" cellpadding="1" cellspacing="0" class="widthfullwide">    <tbody>    <tr class="TableHeaderDark" align="center">      <td style="color:#FFF;" align="left">CATEGORY</td>      <td style="color:#FFF;">K</td>      <td style="color:#FFF;">1</td>      <td style="color:#FFF;">2</td>      <td style="color:#FFF;">3</td>      <td style="color:#FFF;">4</td>      <td style="color:#FFF;">5</td>      <td style="color:#FFF;">6</td>      <td style="color:#FFF;">7</td>      <td style="color:#FFF;">8</td>      <td style="color:#FFF;">9</td>      <td style="color:#FFF;">10</td>      <td style="color:#FFF;">11</td>      <td style="color:#FFF;">12</td>      <td style="color:#FFF;">Total</td>      <td style="color:#FFF;">Pct</td>    </tr>    <tr class="PageText" align="center">      <td align="left">Female</td>      <td> <!-- Female K -->        <xsl:choose>          <xsl:when test="./Grade[@GradeLevel='K' and    @Gender='Female']/@TotalServed">            <xsl:value-of select="./Grade[@GradeLevel='K' and @Gender='Female']/@TotalServed"></xsl:value-of>          </xsl:when>          <xsl:otherwise>0</xsl:otherwise>        </xsl:choose>      </td>      <td>    

No comments:

Post a Comment