Subject: [xsl] sorting and listing From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx (by way of Mulberry Technologies List Owner) Date: Tue, 28 Aug 2001 11:44:05 -0400 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Recursion Was: Re: 2 Ques, Dimitre Novatchev | Thread | [xsl] Templatized processing, by way of Mulberry T |
RE: [xsl] Tutorial, G. Ken Holman | Date | [xsl] Templatized processing, by way of Mulberry T |
Month |