XSLT from excel with duplicates
Posted: Thu Aug 26, 2021 2:48 am
Greetings!
Is there anything I can add to this stylesheet that would consolidate multiple attributes under one "student".
For example on the excel sheet the data is listed as a rows. the student appears multiple times on the sheet for each scholarship.
Student 1 has 3 scholarships
externalFundID= scholarship1 awardAmount = 400
externalFundID=scholarship2 awardAmount= 500
Is there anything I can add to this stylesheet that would consolidate multiple attributes under one "student".
For example on the excel sheet the data is listed as a rows. the student appears multiple times on the sheet for each scholarship.
Student 1 has 3 scholarships
externalFundID= scholarship1 awardAmount = 400
externalFundID=scholarship2 awardAmount= 500
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output indent="yes"/>
<xsl:template match="root">
<students>
<xsl:apply-templates/>
</students>
</xsl:template>
<xsl:template match="row">
<student><xsl:attribute name="externalStudentId1" select="externalStudentId1/text()"/>
<award>
<xsl:attribute name="awardAmount" select="awardAmount/text()"/>
<xsl:attribute name="awardEndDate" select="awardEndDate/text()"/>
<xsl:attribute name="awardStartDate" select="awardStartDate/text()"/>
<xsl:attribute name="awardStatus" select="awardStatus/text()"/>
<xsl:attribute name="externalAwardId" select="externalAwardId/text()"/>
<xsl:attribute name="externalFundId" select="externalFundId/text()"/>
<xsl:attribute name="AwardYear" select="federalAwardYear/text()"/>
<xsl:attribute name="maxDisbursementNumeber" select="maxDisbursementNumber/text()"/>
<xsl:attribute name="offeredOnDate" select="offeredOnDate/text()"/>
<xsl:attribute name="manualAward" select="manualAward/text()"/>
</award>
</student>
</xsl:template>
</xsl:stylesheet>