[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Unique headers

Subject: Unique headers
From: "Kanthi Damodaran" <kanthi_damodaran@xxxxxxxxxxx>
Date: Wed, 04 Apr 2001 13:34:13
unique headers
Hi there

Following is a sample XML file

<MoviesList>
 <Movie>
   <Type>General</Type>
   <Title>Chocolat</Title>
 </Movie>
 <Movie>
   <Type>General</Type>
   <Title>Billy</Title>
 </Movie>
 <Movie>
   <Type>Mystery</Type>
   <Title>Ellen Brokovich</Title>
 </Movie>
 <Movie>
   <Type>Mystery</Type>
   <Title>Pelican Brief</Title>
 </Movie>
 <Movie>
   <Type>Horror</Type>
   <Title>Nightmare on Elm Street</Title>
 </Movie>
 <Movie>
   <Type>Horror</Type>
   <Title>Blair Witch Project</Title>
 </Movie>
 <Movie>
   <Type>General</Type>
   <Title>The Emperor's Groove</Title>
 </Movie>
 <Movie>
   <Type>General</Type>
   <Title>Toy Story</Title>
 </Movie>
</MoviesList>

And I want the output to be as follows -

Chocolat
Billy
Mystery
 Ellen Brokovich
 Pelican Brief
Horror
 Nightmare on Elm Street
 Blair Witch Project
The Emperor's Groove
Toy Story

My XSL file looks like this :-

<xsl:variable name="grpTypes" select="'Mystery Horror'"/>
<xsl:template match="text()"/>
?<xsl:template match="Type">
?? <xsl:choose>
???? <xsl:when test="contains($grpTypes, concat(' ', .))">
?????? <xsl:if test="not(. = preceding::Type)">
???????? <xsl:value-of select="concat(., '&#xA;')"/>
?????? </xsl:if>
?????? <xsl:value-of select="../Title"/>
???? </xsl:when>
???? <xsl:otherwise>
?????? <xsl:value-of select="../Title"/>
???? </xsl:otherwise>
?? </xsl:choose>
?? <xsl:text>&#xA;</xsl:text>
?</xsl:template>

But the output I get it is :-

Chocolat
Billy
Mystery
 Ellen Brokovich
Mystery
 Pelican Brief
Horror
 Nightmare on Elm Street
Horror
 Blair Witch Project
The Emperor's Groove
Toy Story

Any ideas on how to get this done correctly?  Thanks in advance.
Kanthi


_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.