XSL and repeating elements

wxdqz

New Member
I am wondering if anyone can help me with a problem I am having with XSL asI am an XSL newbie.I have the following XML being supplied by a third party so I have no controlover the incoming format.<?xml version="1.0" encoding="UTF-8"?><movies><movie><title>102 Dalmatians</title><movie_id>23690</movie_id><genre>Family</genre><cast>Glenn Close</cast><cast>Alice Evans</cast><cast>Ioan Gruffudd</cast><cast>Gerard Depardieu</cast><cast>Tim McInnerny</cast><director>Kevin Lima</director></movie><movie><title>15 Minutes</title><movie_id>24009</movie_id><genre>Thriller</genre><cast>Robert De Niro</cast><cast>John DiResta</cast><cast>Edward Burns</cast><cast>Melina Kanakaredes</cast><cast>Kelsey Grammer</cast><director>John Herzfeld</director></movie><movie></movies>When I apply the following XSL it all works fine except I get only the first<cast> element. NOTE the parameter is modified in ASP to the selected keyvalue from a previous selection list.<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:param name="index" select="0000"/><xsl:template match="/"><HTML><BODY><CENTER><H2>View Movie Details</H2></CENTER><TABLE BORDER="2"><xsl:for-each select="//movie[movie_id=$index]"><TR><TD>ID</TD><TD><xsl:value-of select="movie_id"/></TD></TR><TR><TD>Title</TD><TD><xsl:value-of select="title"/></TD></TR><TR><TD>Genre</TD><TD><xsl:value-of select="genre"/></TD></TR><TR><TD>Cast</TD><TD><xsl:value-of select="cast"/></TD></TR></xsl:for-each></TABLE></BODY></HTML></xsl:template></xsl:stylesheet>If I add the for-each as below I get no <cast> elements at all!<xsl:for-each select="cast"><xsl:value-of select="cast"/></xsl:for-each>Can someone explain what is wrong and how I can alter it to return all castelements in the same table cell?thanks
 
Back
Top