|
next
|
 Subject: xsl - header only once in foreach Author: erik t Date: 23 Dec 2008 05:38 AM
|
hi all,
i want to do the following: in this xsl below i'm doing a grouping and a foreach and according to 'position() = 1' i'm displaying a header. now i also would like to display some h3 in the other TD, but only once. not once every foreach, but once at all.
any help would be most appreciated, cause i'm out of tricks for this one. it would be most helpful if i wouldn't have to change a thing about the structure, but some <xsl:if>-trick which would do it for me! thnx!
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" version="4.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<xsl:key name="grouperen" match="element" use="concat( categorienaam , '' )"/>
<xsl:template match="/">
<table class="list" cellpadding="0" cellspacing="0" border="0" width="98%">
<xsl:for-each select="//elementen/element[generate-id(.)=generate-id(key('grouperen', concat(categorienaam , '' )))]">
<xsl:sort select="categorienaam"/>
<xsl:for-each select="key('grouperen', concat( categorienaam , '' ))">
<xsl:if test="position() = 1">
<tr>
<td class="header">
<h3>
<xsl:value-of select="categorienaam"/>
</h3>
</td>
<td valign="bottom" colspan="2" nowrap="nowrap">
<h3> <!- i want this only once: -->
From
</h3>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
|
|
|