|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








