This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
removing duplicates in loops
- From: Yi Qin <yiqin at BPA dot Arizona dot EDU>
- To: XSL-List at lists dot mulberrytech dot com
- Date: Mon, 1 Apr 2002 23:20:19 -0700 (MST)
- Subject: [xsl] removing duplicates in loops
- Reply-to: xsl-list at lists dot mulberrytech dot com
i have the following xsl and want to remove repeated education
and honor elements. how should i achieve that?
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="rowset">
<xsl:for-each
select="/rowset/row/resumeid[not(preceding::resumeid=.)]">
<xsl:sort select="."/>
<resume id="{.}">
<name>
<first_name><xsl:value-of
select="/rowset/row/fname"/></first_name>
<middle_initial><xsl:value-of
select="/rowset/row/middle"/></middle_initial>
<last_name><xsl:value-of
select="/rowset/row/lname"/></last_name>
<maiden_name><xsl:value-of
select="/rowset/row/maiden"/></maiden_name>
<suffix><xsl:value-of select="/rowset/row/suffix"/></suffix>
</name>
<objective><xsl:value-of
select="/rowset/row/objective"/></objective>
<xsl:for-each select="/rowset/row[resumeid = current()]">
<education>
<school><xsl:value-of select="school"/></school>
<department><xsl:value-of select="dept"/></department>
<school_address>
<school_city><xsl:value-of select="city"/></school_city>
<school_state><xsl:value-of select="state"/></school_state>
<school_country><xsl:value-of
select="country"/></school_country>
</school_address>
<degree><xsl:value-of select="degree"/></degree>
<major><xsl:value-of select="major"/></major>
<minor><xsl:value-of select="minor"/></minor>
<grad_date><xsl:value-of select="gdate"/></grad_date>
<gpa>
<major_gpa><xsl:value-of select="magpa"/></major_gpa>
<minor_gpa><xsl:value-of select="migpa"/></minor_gpa>
<overall_gpa><xsl:value-of select="ovgpa"/></overall_gpa>
<class_standing><xsl:value-of select="cs"/></class_standing>
</gpa>
</education>
</xsl:for-each>
<xsl:for-each select="/rowset/row[resumeid = current()]">
<honor>
<honor_name><xsl:value-of select="hname"/></honor_name>
<honor_date><xsl:value-of select="hdate"/></honor_date>
</honor>
</xsl:for-each>
</resume>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list