This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Unique headers
- To: "Kanthi Damodaran" <kanthi_damodaran at hotmail dot com>
- Subject: Re: [xsl] Unique headers
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Thu, 5 Apr 2001 14:33:22 +0100
- CC: XSL-List at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <F37n20lbhsKd6QR7j1H000009e9@hotmail.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Kanthi,
That's strange. When I try your code, I get:
Chocolat
Billy
Ellen Brokovich
Pelican Brief
Horror
Nightmare on Elm Street
Blair Witch Project
The Emperor's Groove
Toy Story
This isn't the output that you say you get, which makes me think that
perhaps you posted the wrong code?
Anyway, when I make the necessary changes so that the XSLT recognises
the first of the categories under $grpTypes, and add some spaces to
get indentation:
<xsl:variable name="grpTypes" select="'Mystery Horror'"/>
<xsl:template match="text()"/>
<xsl:template match="Type">
<xsl:choose>
<!-- changed following line so that first category is recognised
-->
<xsl:when test="contains(concat(' ', $grpTypes),
concat(' ', .))">
<xsl:if test="not(. = preceding::Type)">
<xsl:value-of select="concat(., '
')"/>
</xsl:if>
<!-- added indentation -->
<xsl:text> </xsl:text>
<xsl:value-of select="../Title"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="../Title"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>
</xsl:text>
</xsl:template>
Then I get the output that you want:
Chocolat
Billy
Mystery
Ellen Brokovich
Pelican Brief
Horror
Nightmare on Elm Street
Blair Witch Project
The Emperor's Groove
Toy Story
I hope that helps,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list