homepage Welcome to WebmasterWorld Guest from
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

5+ Year Member

Msg#: 3169879 posted 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.


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 id="b2">
<movie>A DAY AT THE RACES (1937)</movie>
<movie>A SHOT IN THE DARK (1964)</movie>
<movie>AMERICAN GRAFFITI (1973)</movie>
<ballot id="b3">

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="/">
<head><title>Top American Comedies</title>
<link href="comedy.css" rel="stylesheet" type="text/css" />
<h2>The Top American Comedy Films</h2>
<h4> Number of Ballots: total </h4>
<table width="550">
<!-- ************** start of my code *************** -->
<xsl:for-each select="//ballot[generate-id()=generate-id(key('movies', movie)[1])]">
<xsl:sort select="movie"/>
<td><xsl:value-of select="movie" /></td>
<!-- ************** end of my code *************** -->



WebmasterWorld Senior Member 10+ Year Member

Msg#: 3169879 posted 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