Click to See Complete Forum and Search --> : link displaying


smootherkat
04-07-2009, 10:35 AM
Hi I have a list 5 movies and i need to have a linkto a webpage to each of the movies. Here is what i have so for.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="4.0" />
<xsl:template match="/">
<html>
<head>
<title>Movies</title>
<link href="movies2.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>My Movies</h1>
<table border="12" cellspacing="0">
<tr bgcolor="#9acd32">
<th>Movies</th>
<th>Release Date</th>
<th>Director</th>
<th>Main Actor</th>
<th>Main Actors</th>
<th>Discirption</th>
<th>Category</th>
</tr>
<xsl:for-each select="movies/movie">
<xsl:sort select=" category " order="ascending" data-type="text" />
<tr>
<td>
<a href= "../link">
<xsl:value-of select="movie_name"/>
<xsl:value-of select="@symbol" />
</a>
</td>
<td>
<xsl:value-of select="release " />
</td>
<td>
<xsl:value-of select="director"/>
</td>
<td>
<xsl:value-of select="actor_name"/>
</td>
<td>
<xsl:value-of select="actors_name"/>
</td>
<td>
<xsl:value-of select="discription"/>
</td>
<td>
<xsl:value-of select="category"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Here is my XTML
<?xml-stylesheet type="text/xsl" href="movie.xsl" ?>
<movies xmlns:html="http://www.w3.org/1999/xhtml">
<title>My Favorite Movies: </title>
<movie>
<movie_name>Titanic</movie_name>
<release> 1997</release>
<director> James Cameron</director>
<actor_name>
<first> Leonardo</first>
<last>DiCaprio</last>
</actor_name>
<actors_name>
<first> Kate</first>
<last>Winslet</last>
</actors_name>
<discription>Two members of different social classes who fall in love aboard the ill-fated voyage of the ship.</discription>
<category>Romatic-Drama</category>
</movie>
<movie>
<movie_name>Sixth Sense</movie_name>
<release>1999</release>
<director> M. Night Shyamalan.</director>
<actor_name>
<first>Bruce</first>
<last>Willis</last>
</actor_name>
<actors_name>
<first>Haley Joel</first>
<last>Osment</last>
</actors_name>
<discription>A troubled, isolated boy who claims to be able to see and talk to the dead,
and an equally troubled child psychologist who tries to help him.</discription>
<category>Psychological Horror</category>
</movie>

dmboyd
04-07-2009, 02:01 PM
Each of your movie elements would need an attribute, e.g. href, or a child element that supplies the URL. From there, you would be able to include an anchor in your XSLT document that uses that URL.

smootherkat
04-08-2009, 07:44 AM
Thanks I got it