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

sorting and listing

Subject: sorting and listing
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx (by way of MulberryTechnologies List Owner)
Date: Tue, 28 Aug 2001 11:44:05 -0400
sorting and listing
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: HELP:  sorting and listing
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hello,
   i am starting to get my first xsl stylesheets to work, but now
there are some problems.
i have the following xml file with list of members with name and city:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="members.xsl"?>
<members>
     <member>
         <name>Philips</name>
         <city>London</city>
     </member>
     <member>
         <name>Michael</name>
         <city>Paris</city>
     </member>
     <member>
         <name>Smith</name>
         <city>London</city>
     </member>
     <member>
         <name>Hans</name>
         <city>Berlin</city>
     </member>
     <member>
         <name>Peter</name>
         <city>New York</city>
     </member>
     <member>
         <name>Gabriel</name>
         <city>Berlin</city>
     </member>
</members>

the following stylesheet should display the city names
only once and the name of members who live in should be
listed under the city names:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0">
   <xsl:template match="/">
     <html>
       <xsl:apply-templates/>
     </html>
   </xsl:template>

   <xsl:template match="members">
     <p><ul>
     <xsl:for-each select="member">
       <xsl:sort select="city"/>

           <xsl:if test="city != preceding::city">
         <u><h1><xsl:value-of select="city"/></h1></u>
       </xsl:if>

           <li><xsl:value-of select="name"/></li>

         </xsl:for-each>
     </ul></p>
   </xsl:template>

</xsl:stylesheet>

so i do firstly sort the list by city names and then want to detect the 
chane of city name, if true then display it. i have got the follwing 
output which istnt right:

Berlin
   Hans
Berlin
   Gabriel
   Philips
London
   Smith
New York
   Peter
   Paris
   Michael

correct output would be like:

Berlin
   Hans
   Gabriel
London
   Philips
   Smith
Paris
   Michael
New York
   Peter


ANY HINTS , SOLUTION ??
PLEASE reply to my email addres, because i am facing problems with
the subscribtion of the this list.


thanks
hussnain

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


Current Thread
  • sorting and listing
    • by way of MulberryTechnologies List Owner - Tue, 28 Aug 2001 11:58:37 -0400 (EDT) <=

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.