<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
	method="html"
	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
	doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
	indent="yes"
	encoding="iso-8859-1" />

<!--
	the following variables, with an enable_ prefix, allow you to
	switch features on or off. only the value of 1 will activate
	a feature. use 0 (zero) to deactivate it. set the max_items
	variable to the maximum number of items you want to appear
	in the output, e.g. 5 or 10
  -->

<xsl:variable name="max_items" select="5" />

<xsl:variable name="enable_header" select="1" />
<xsl:variable name="enable_header_title" select="1" />
<xsl:variable name="enable_header_image" select="1" />
<xsl:variable name="enable_header_summary" select="1" />
<xsl:variable name="enable_header_submit_review" select="1" />
<xsl:variable name="enable_report_review" select="1" />
<xsl:variable name="enable_reviewer_byline" select="1" />
<xsl:variable name="enable_average_rating" select="1" />
<xsl:variable name="enable_average_rating_image" select="0" />
<xsl:variable name="enable_average_rating_numeric" select="1" />
<xsl:variable name="enable_attribute_ratings" select="1" />
<xsl:variable name="enable_avatars" select="1" />
<xsl:variable name="enable_pros" select="1" />
<xsl:variable name="enable_cons" select="1" />
<xsl:variable name="enable_review_text" select="1" />
<xsl:variable name="enable_read_more" select="1" />
<xsl:variable name="enable_image_frames" select="1" />

<!--
	WARNING:
	unless you really know what you are doing (e.g. you fully
	understand the subtlies of tag balancing in XSL markup)
	do NOT edit anything beyond this point, except maybe the
	CSS styling found in the first style block. be careful,
	it is very easy to disable the functionality of this page.
  -->

<xsl:variable name="title" select="/rss/channel/title" />
<xsl:variable name="link"  select="/rss/channel/link" />
<xsl:variable name="syndication_url" select="/rss/channel/docs" />

<xsl:template match="rss/channel">

<style type="text/css">

	a.foundry:link, a.foundry:active, a.foundry:hover, a.foundry:visited
	{
		text-decoration: none;
		font-weight:     bold;
	  	font-family:     "lucida grande",bitstream vera sans,verdana,sans-serif,sans-serif
	}
	a.foundry:link
	{
		color: #7f804d;
	}
	a.foundry:active, a.foundry:hover
	{
		color: #c60;
	}
	a.foundry:visited
	{
		color: #c60;
	}
	.foundry_rss
	{
		background-color: #ffffff;
		color: #666666;
		font-size:   9pt;
		font-family: "lucida grande",bitstream vera sans,verdana,sans-serif,sans-serif
	}
	.foundry_header_title
	{
		font-size: 13pt;
	}
	.foundry_item_summary
	{
		font-size: 13pt;
	}
	.foundry_divider
	{
		border-top: dashed 1px #d0d0d0;
		height: 1px;
		width: 100%;
		clear: both;
	}
</style>

<style type="text/css">
	/* start CSS for framed images */

	.foundry_framed_top_edge {
		width: auto;
		height: 5px;
		background-image: url(../../../../skins/default/images/frame/frame_top.gif);
		background-repeat: repeat-x;
		border: 0px;
	}
	.foundry_framed_left_edge {
		height: auto;
		width: 5px;
		background-image: url(../../../../skins/default/images/frame/frame_left.gif);
		background-repeat: repeat-y;
		border: 0px;
	}
	.foundry_framed_right_edge {
		height: auto;
		width: 5px;
		background-image: url(../../../../skins/default/images/frame/frame_right.gif);
		background-repeat: repeat-y;
		border: 0px;
	}
	.foundry_framed_bottom_edge {
		width: auto;
		height: 5px;
		background-image: url(../../../../skins/default/images/frame/frame_bottom.gif);
		background-repeat: repeat-x;
		border: 0px;
	}
	.foundry_framed_top {
		height: 5px;
		background: url(../../../../skins/default/images/frame/frame_upper_right.gif) no-repeat top right;
		border: 0px solid red;
	}
	.foundry_framed_bottom {
		height: 5px;
		background: url(../../../../skins/default/images/frame/frame_lower_right.gif) no-repeat bottom right;
		border: 0px solid red;
	}
	img.foundry_framed_corner {
		width:  5px;
		height: 5px;
		border: none;
		display: block !important;
	}
	.foundry_framed_center {
		border-top:    3px solid #ffffff;
		border-left:   3px solid #ffffff;
		border-right:  6px solid #ffffff;
		border-bottom: 6px solid #ffffff;
	}
	/* end CSS for framed images */
</style>

	<center>
	<table width="600" border="0" class="foundry_rss">
	<xsl:if test="$enable_header = 1">
	<tr><td style="padding-top: 6px; padding-left: 6px; padding-right: 6px;"
		align="left"><xsl:apply-templates select="*[local-name()='thing_info']" />
 		</td></tr>
	</xsl:if>
	<tr><td style="padding-top: 6px; padding-left: 6px; padding-right: 6px;"
		align="left"><xsl:apply-templates select="item" />
 		</td></tr>
	</table>
	</center>

</xsl:template>

<xsl:template match="*[local-name()='thing_info']">

  <xsl:if test="$enable_header_title = 1 or $enable_header_submit_review = 1">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
	<xsl:if test="$enable_header_title = 1">
		<td><a class="foundry" href="{*[local-name()='read_review_url']}"
			><span class="foundry_header_title"><xsl:value-of select="$title" /></span></a></td>
	</xsl:if>
	<xsl:if test="$enable_header_submit_review = 1">
		<td align="right"><a class="foundry" href="{*[local-name()='submit_review_url']}"
			>Submit Review</a></td>
	</xsl:if>
		</tr>
	</table>
	<br/>
  </xsl:if>

  <xsl:if test="$enable_header_image = 1">
	<xsl:if test="string(*[local-name()='thing_image'])">
		<table style="float:left; margin-right:10px; margin-bottom:10px;"><tr><td>
		<xsl:apply-templates select="*[local-name()='thing_image']" />
		</td></tr></table>
	</xsl:if>
  </xsl:if>

  <xsl:if test="$enable_header_summary = 1">
	<p>
	<xsl:if test="string(*[local-name()='summary'])">
		<b>Description</b>
		<br/><br/><xsl:value-of select="*[local-name()='summary']" />
	</xsl:if>
	</p>
  </xsl:if>

	<div class="foundry_divider"></div>

</xsl:template>

<xsl:template match="item">

    <xsl:if test="$max_items >= position()">

    <table border="0" width="100%">
    <tr><td align="left">

	<table width="100%" border="0" cellpadding="2" cellspacing="0">
	<tr>	<td>

		<b class="foundry_item_summary">
			<xsl:apply-templates select="*[local-name()='review_summary']" />
		</b>

	<xsl:if test="$enable_reviewer_byline = 1">
		<br/><br/><b>Reviewer:</b> <xsl:text> </xsl:text>
			<xsl:apply-templates select="*[local-name()='review_author']" />
	</xsl:if>

	<xsl:if test="$enable_reviewer_byline = 1 and $enable_average_rating = 1">
		<xsl:text> </xsl:text> | <xsl:text> </xsl:text>
	</xsl:if>

	<xsl:if test="$enable_average_rating = 1">
		<xsl:if test="not($enable_reviewer_byline = 1)"><br/><br/></xsl:if>
		<b>Avg. Rating:</b> <xsl:text> </xsl:text>
		<xsl:if test="$enable_average_rating_image = 1">
			<xsl:apply-templates select="*[local-name()='average_rating_image']" />
			<xsl:text> </xsl:text>
		</xsl:if>
		<xsl:if test="$enable_average_rating_numeric = 1">
			<xsl:apply-templates select="*[local-name()='average_rating_unit']" />
		</xsl:if>
	</xsl:if>
		</td>
	<xsl:if test="$enable_report_review = 1">
		<td align="right" valign="top"><a class="foundry"
			href="{*[local-name()='report_review_url']}"
			>report review</a>
		</td>
	</xsl:if>
		</tr>
	</table>

	<xsl:if test="$enable_attribute_ratings">
	<br/>
	<table border="0" cellpadding="2" cellspacing="0">
	<xsl:apply-templates select="*[local-name()='rating']" />
	</table>
	</xsl:if>

    <xsl:if test="$enable_avatars = 1 or $enable_pros = 1 or $enable_cons = 1">
	<br/>
	<table border="0" cellpadding="0" cellspacing="0">
	<tr>	<xsl:if test="$enable_avatars = 1">
			<xsl:if test="*[local-name()='avatar_image']">
		<td>
			<xsl:apply-templates select="*[local-name()='avatar_image']" />
		</td>
		<td style="padding: 4px;"></td>
			</xsl:if>
		</xsl:if>
		<td>
	<xsl:if test="$enable_pros = 1">
		<b>Pros:</b> <xsl:text> </xsl:text>
			<xsl:apply-templates select="*[local-name()='review_pros']" />
	</xsl:if>
	<xsl:if test="$enable_cons = 1">
		<xsl:if test="$enable_pros = 1"><br/></xsl:if>
		<b>Cons:</b> <xsl:text> </xsl:text>
		<xsl:apply-templates select="*[local-name()='review_cons']" />
	</xsl:if>
		</td></tr>
	</table>
    </xsl:if>

	<p>
	<xsl:if test="$enable_review_text = 1">
		<xsl:apply-templates select="*[local-name()='review_text']" /> <xsl:text> </xsl:text>
	</xsl:if>
	<xsl:if test="$enable_read_more = 1">
		<a class="foundry" href="{./link}" title="read more">read more</a>
	</xsl:if>
	</p>
	<div class="foundry_divider"></div>

	</td></tr>
    </table>

</xsl:if>

</xsl:template>

<xsl:template match="*[local-name()='average_rating_unit']">
	<xsl:apply-templates />
</xsl:template>

<xsl:template match="*[local-name()='rating']">
	<tr><td valign="bottom"><b><xsl:apply-templates select="*[local-name()='rating_attribute']" />:</b></td>
	    <td valign="bottom"><xsl:apply-templates select="*[local-name()='rating_image']" /></td></tr>
</xsl:template>

<xsl:template match="*[local-name()='image_url']">
	<xsl:if test="string(.)">
	<img>
		<xsl:attribute name="src">
			<xsl:value-of select="." />
		</xsl:attribute>
		<xsl:attribute name="width">
			<xsl:value-of select="../*[local-name()='image_width']" />
		</xsl:attribute>
		<xsl:attribute name="height">
			<xsl:value-of select="../*[local-name()='image_height']" />
		</xsl:attribute>
		<xsl:attribute name="align">bottom</xsl:attribute>
		<xsl:attribute name="border">0</xsl:attribute>
		<xsl:attribute name="hspace">0</xsl:attribute>
	</img>
	</xsl:if>
</xsl:template>

<xsl:template match="*[local-name()='review_author']">
	<xsl:value-of select="*[local-name()='nickname']" />
</xsl:template>

<xsl:template match="*[local-name()='review_summary']">
	<xsl:apply-templates />
</xsl:template>

<xsl:template match="*[local-name()='review_pros']">
	<xsl:apply-templates />
</xsl:template>

<xsl:template match="*[local-name()='review_cons']">
	<xsl:apply-templates />
</xsl:template>

<xsl:template match="*[local-name()='review_text']">
	<xsl:apply-templates />
</xsl:template>

<xsl:template match="*[local-name()='thing_image']">
	<xsl:apply-templates select="*[local-name()='framed_image']" />
	<xsl:apply-templates select="*[local-name()='non_framed_image']" />
</xsl:template>

<xsl:template match="*[local-name()='average_rating_image']">
	<xsl:apply-templates select="*[local-name()='non_framed_image']" />
</xsl:template>

<xsl:template match="*[local-name()='rating_image']">
	<xsl:apply-templates select="*[local-name()='non_framed_image']" />
</xsl:template>

<xsl:template match="*[local-name()='avatar_image']">
	<xsl:apply-templates select="*[local-name()='framed_image']" />
	<xsl:apply-templates select="*[local-name()='non_framed_image']" />
</xsl:template>

<xsl:template match="*[local-name()='non_framed_image']">
	<xsl:apply-templates select="*[local-name()='image_url']" />
</xsl:template>

<xsl:template match="*[local-name()='framed_image']">

  <xsl:if test="$enable_image_frames = 0">
	<xsl:apply-templates select="*[local-name()='image_url']" />
  </xsl:if>
  <xsl:if test="$enable_image_frames = 1">

	<table cellspacing="0" cellpadding="0" border="0">
	<tr><td colspan="3" class="foundry_framed_top_edge"
		><div class="foundry_framed_top"><img
		src="../../../../skins/default/images/frame/frame_upper_left.gif"
		width="5"
		height="5"
		class="foundry_framed_corner" 
		style="display: none;"
		 /></div></td></tr>
	<tr>	<td class="foundry_framed_left_edge"></td>
		<td><div class="foundry_framed_center"
			><xsl:apply-templates select="*[local-name()='image_url']" /></div></td>
		<td class="foundry_framed_right_edge"></td></tr>
	<tr><td colspan="3" class="foundry_framed_bottom_edge"
		><div class="foundry_framed_bottom"><img
		src="../../../../skins/default/images/frame/frame_lower_left.gif"
		width="5"
		height="5"
		class="foundry_framed_corner" 
		style="display: none;"
		border="0"
		 /></div></td></tr>
	</table>
  </xsl:if>

</xsl:template>

</xsl:stylesheet>