homepage Welcome to WebmasterWorld Guest from 54.204.94.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
muenchian grouping
can not extract elements from document
dnomsed




msg:3169881
 10:39 pm on Nov 27, 2006 (gmt 0)

I'm student of XML and need some help.
I'm trying to use the muenchian grouping to extract the first occurance of each movie title. There are no duplicate titles in a ballot, but the title can be repeated in each ballot. My code only extracts the first move from the first ballot.

Thanks
Desmond

XML document format
<poll> root element
<ballot id="b1">
<movie>A FISH CALLED WANDA (1988)</movie>
<movie>ADAM'S RIB (1949)</movie>
<movie>ANNIE HALL (1977)</movie>
.
.
.
</ballot>
<ballot id="b2">
<movie>A DAY AT THE RACES (1937)</movie>
<movie>A SHOT IN THE DARK (1964)</movie>
<movie>AMERICAN GRAFFITI (1973)</movie>
.
.
.
</ballot>
<ballot id="b3">
.
.
.
</poll>

XSL document
<?xml version="1.0"?>
<xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="movies" match="//ballot" use="movie" /><xsl:template match="/">
<html>
<head><title>Top American Comedies</title>
<link href="comedy.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h2>The Top American Comedy Films</h2>
<h4> Number of Ballots: total </h4>
<table width="550">
<tr>
<th>Rank</th>
<th>Movie</th>
<th>Votes</th>
<th>%</th>
</tr>
<!-- ************** start of my code *************** -->
<xsl:for-each select="//ballot[generate-id()=generate-id(key('movies', movie)[1])]">
<xsl:sort select="movie"/>
<tr>
<td><xsl:value-of select="movie" /></td>
</tr>
</xsl:for-each>
<!-- ************** end of my code *************** -->
</table>
</body>
</html>
</xsl:template></xsl:stylesheet>

 

choster




msg:3172070
 2:30 pm on Nov 29, 2006 (gmt 0)

Your code works exactly right for me. What is the problem you're experiencing?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved