xsl-list
[Top] [All Lists]

[xsl] Only first rows (after the sort)

2006-08-15 07:22:59
Hi,
 
I have a problem transforming an XML file to the desired table
structure. I hope someone can help me.
 
Here is the XML file I use:
<example>
  <category>XML</category> 
  <year>2005</year>
</example>
<example>
  <category>XSL</category> 
  <year>2005</year>
</example>
<example>
  <category>XSL</category> 
  <year>2006</year>
</example>
<example>
  <category>XML</category> 
  <year>2005</year>
</example>
...
 
Here is how the table should look eventually:
Catagory    Year       
XML         2005
XSL         2005
XSL         2006
...
 
My current XSL:
 
<xsl:for-each select="example">
<xsl:sort select="category"><xsl:sort select="year">
<tr><td><xsl:value-of select="./category"></td><td><xsl:value-of
select="./year"></td></tr>
</xsl:for-each>
 
This results in:
Catagory    Year       
XML         2005
XML         2005
XSL         2005
XSL         2006
...
 
So what I'm trying to do is to skip rows when the combination of
category and year are identical  (skip the duplicates). I've tried to
put it in an <xsl:if> combined with <xsl:variable> construction, but I
just can't get it right. Does anyone have an idea?
 
Kind regards,
Dennis

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>