<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  version="1.0">
  <xsl:output method="html" encoding="utf-8"/>

  <xsl:template match="/">

    <html>
      <head>
        <title>Amazon サーチ by Goodpic</title>
      </head>

<link rel="stylesheet" href="http://www.goodpic.com/mt/styles-site.css" type="text/css" />

      <body><div class="pic">


<div class="refer">
G-Toolsが新しくなりました。選べる商品紹介のデザインは、なんと30種類以上！<br />
</div>
<br />
<xsl:variable name="asin" select="ProductInfo/Details/Asin" />


	<a>
  	<xsl:attribute name="href">
  	<xsl:value-of select="concat('http://www.umizoi.com/g-tools/tools.php?view=styles&amp;asin=', $asin)" />
  	</xsl:attribute>新しく増えたデザインから選ぶ
  	</a>
<br />




	</div>
      </body>
    </html>
</xsl:template>


<xsl:template match="Details">

<xsl:variable name="baseurl">http://www.amazon.co.jp/exec/obidos/ASIN/</xsl:variable>
<xsl:variable name="asin" select="Asin" />
<xsl:variable name="productname" select="ProductName" />
<xsl:variable name="imgmedium" select="ImageUrlMedium" />
<xsl:variable name="imgsmall" select="ImageUrlSmall" />
<xsl:variable name="listprice" select="ListPrice" />
<xsl:variable name="ourprice" select="OurPrice" />
<xsl:variable name="salesrank" select="SalesRank" />
<xsl:variable name="releasedate" select="ReleaseDate" />
<xsl:variable name="availavility" select="Availability" />

<!-- Start of Hidden -->

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">asin</xsl:attribute>
	<xsl:attribute name="value"><xsl:value-of select="$asin" />
	</xsl:attribute>
	</input>

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">productname</xsl:attribute>
	<xsl:attribute name="value"><xsl:value-of select="$productname" />
	</xsl:attribute>
	</input>

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">imgmedium</xsl:attribute>
	<xsl:attribute name="value"><xsl:value-of select="$imgmedium" />
	</xsl:attribute>
	</input>

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">imgsmall</xsl:attribute>
	<xsl:attribute name="value"><xsl:value-of select="$imgsmall" />
	</xsl:attribute>
	</input>

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">listprice</xsl:attribute>
	<xsl:attribute name="value"><xsl:value-of select="$listprice" />
	</xsl:attribute>
	</input>

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">ourprice</xsl:attribute>
	<xsl:attribute name="value"><xsl:value-of select="$ourprice" />
	</xsl:attribute>
	</input>

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">salesrank</xsl:attribute>
	<xsl:attribute name="value"><xsl:value-of select="$salesrank" />
	</xsl:attribute>
	</input>

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">releasedate</xsl:attribute>
	<xsl:attribute name="value"><xsl:value-of select="$releasedate" />
	</xsl:attribute>
	</input>

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">availavility</xsl:attribute>
	<xsl:attribute name="value"><xsl:value-of select="$availavility" />
	</xsl:attribute>
	</input>

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">authors</xsl:attribute>
	<xsl:attribute name="value"><xsl:apply-templates select="Authors"/><xsl:apply-templates select="Artists"/>
	</xsl:attribute>
	</input>

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">avg</xsl:attribute>
	<xsl:attribute name="value">
		<xsl:value-of select="Reviews/AvgCustomerRating" />
	</xsl:attribute>
	</input>

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">isprice</xsl:attribute>
	<xsl:attribute name="value">false</xsl:attribute>
	</input>

	<input>
	<xsl:attribute name="type">hidden</xsl:attribute>
	<xsl:attribute name="name">reviews</xsl:attribute>
	<xsl:attribute name="value">
		<xsl:apply-templates select="Reviews/CustomerReview">
		<xsl:with-param name="decode">1</xsl:with-param>
		<xsl:sort select="Rating"/>
		</xsl:apply-templates>
	</xsl:attribute>
	</input>

<!-- END of Hidden -->


	<table width="700" border="1" bordercolor="#ddddddff">
	<tr>
	<td width="150" bgcolor="#bbbbbb">
	　選んでください
	</td>
	<td bgcolor="#bbbbbb">
	　サンプル
	</td>
	</tr>
	<tr>
	<td valign="top" width="150" bgcolor="#ddddff">
	<input type="radio" name="outType" value="takusan">
	<xsl:attribute name="checked">checked</xsl:attribute>
	</input>
	　盛り沢山　
	</td>
	<td valign="top" width="550">

<!-- Start of Takusan -->

	<table border="0" cellpadding="5" width="550">
	<tr><td colspan="2">

  	<a>
  	<xsl:attribute name="href">
  	<xsl:value-of select="concat($baseurl, $asin, '/goodpic-22/')" />
  	</xsl:attribute>
  	<xsl:value-of select="$productname"/>
  	</a>

	</td></tr><tr><td valign="top">

  	<a>
  	<xsl:attribute name="href">
  	<xsl:value-of select="concat($baseurl, $asin, '/goodpic-22/')" />
  	</xsl:attribute>
  	<img>
  	  <xsl:attribute name="src">
  	  <xsl:value-of select="$imgmedium"/>
  	  </xsl:attribute>
  	  <xsl:attribute name="border">0</xsl:attribute>
	</img>
  	</a>
	
	</td><td valign="top">
	<xsl:apply-templates select="Authors"/><xsl:apply-templates select="Artists"/>
	<br />
	
	<font size="-1">
	発売日　<b><xsl:value-of select="$releasedate"/></b><br />
	売り上げランキング　<b><xsl:value-of select="$salesrank"/></b><br />
	価格　<b><xsl:value-of select="$ourprice"/></b>　［　定価　<xsl:value-of select="$listprice"/>　］<br />
	<xsl:value-of select="$availavility"/><br />
	</font>
	<br />

	<xsl:apply-templates select="Reviews/AvgCustomerRating" />

	<xsl:apply-templates select="Reviews/CustomerReview">
	  <xsl:sort select="Rating"/>
	</xsl:apply-templates>

	<br />
	<font size="-1">
  	<a>
  	<xsl:attribute name="href">
  	<xsl:value-of select="concat($baseurl, $asin, '/goodpic-22/')" />
  	</xsl:attribute>
  	Amazonで詳しく見る
	</a>
	</font>
	
	<img src="http://www.goodpic.com/mt/images/spacer.gif" width="80" height="1" /><a href="http://www.goodpic.com/mt/aws/"><img src="http://www.goodpic.com/mt/aws/powered-by-gtool.gif" border="0" /></a><br />

	</td></tr></table>

<!-- End of Takusan -->

<br />
</td>
</tr>

<tr>
<td valign="top" bgcolor="#ddddff" width="150">
<input type="radio" name="outType" value="jouhou" />　情報重視　
</td>
<td valign="top" width="550">

<!-- Start of Jouhou -->

	<table border="0" cellpadding="5" width="550">
	<tr><td valign="top">

	<xsl:call-template name="ShowImg">
		<xsl:with-param name="img"><xsl:value-of select="$imgmedium"/>
		</xsl:with-param>
		<xsl:with-param name="asin"><xsl:value-of select="$asin"/>
		</xsl:with-param>
	</xsl:call-template>

	</td><td valign="top">

	<a>
  	<xsl:attribute name="href">
  	<xsl:value-of select="concat($baseurl, $asin, '/goodpic-22/')" />
  	</xsl:attribute>
  	<xsl:value-of select="$productname"/>
  	</a>
	<br />

	<xsl:apply-templates select="Authors"/><xsl:apply-templates select="Artists"/>
	<br />

	<font size="-1">
	発売日　<b><xsl:value-of select="$releasedate"/></b><br />
	売り上げランキング　<b><xsl:value-of select="$salesrank"/></b><br />
	価格　<b><xsl:value-of select="$ourprice"/></b>　［　定価　<xsl:value-of select="$listprice"/>　］<br />
	<xsl:value-of select="$availavility"/><br />
	</font>


	<br />
	<font size="-1">
	<a>
  	<xsl:attribute name="href">
  	<xsl:value-of select="concat($baseurl, $asin, '/goodpic-22/')" />
  	</xsl:attribute>
  	Amazonで詳しく見る
	</a>
	</font>

	<img src="http://www.goodpic.com/mt/images/spacer.gif" width="80" height="1" /><a href="http://www.goodpic.com/mt/aws/"><img src="http://www.goodpic.com/mt/aws/powered-by-gtool.gif" border="0" /></a><br />

	</td></tr></table>

<!-- End of Jouhou -->

<br />
</td>
</tr>

<tr>
<td valign="top" bgcolor="#ddddff" width="150">
<input type="radio" name="outType" value="osusume" />　おすすめ　
</td>
<td valign="top" width="550">

<!-- Start of Osusume -->

	<table border="0" cellpadding="5" width="550">

	<tr><td valign="top">

	<xsl:call-template name="ShowImg">
		<xsl:with-param name="img"><xsl:value-of select="$imgmedium"/>
		</xsl:with-param>
		<xsl:with-param name="asin"><xsl:value-of select="$asin"/>
		</xsl:with-param>
	</xsl:call-template>
	

	</td><td valign="top">

	<a>
  	<xsl:attribute name="href">
  	<xsl:value-of select="concat($baseurl, $asin, '/goodpic-22/')" />
  	</xsl:attribute>
  	<xsl:value-of select="$productname"/>
  	</a>
	<br />

	<xsl:apply-templates select="Authors"/><xsl:apply-templates select="Artists"/><br />

	<font size="-1">
	価格　<b><xsl:value-of select="$ourprice"/></b>　［　定価　<xsl:value-of select="$listprice"/>　］<br />
	<xsl:value-of select="$availavility"/><br />
	</font>

	<br />

	<xsl:apply-templates select="Reviews/AvgCustomerRating"/>
	<xsl:apply-templates select="Reviews/CustomerReview">
	  <xsl:sort select="Rating"/>
	</xsl:apply-templates>


	<br />
	<font size="-1">
	<a>
  	<xsl:attribute name="href">
  	<xsl:value-of select="concat($baseurl, $asin, '/goodpic-22/')" />
  	</xsl:attribute>
  	Amazonで詳しく見る
	</a>
	</font>

	<img src="http://www.goodpic.com/mt/images/spacer.gif" width="80" height="1" /><a href="http://www.goodpic.com/mt/aws/"><img src="http://www.goodpic.com/mt/aws/powered-by-gtool.gif" border="0" /></a><br />

	 </td></tr></table>

<!-- End of Osusume -->

<br />
</td>
</tr>

<tr>
<td valign="top" bgcolor="#ddddff" width="150">
<input type="radio" name="outType" value="notable" />　&lt;table&gt;なし　
</td>
<td valign="top" width="550">

<!-- Start of No Table -->

	<a>
  	<xsl:attribute name="href">
  	<xsl:value-of select="concat($baseurl, $asin, '/goodpic-22/')" />
  	</xsl:attribute>
  	<xsl:value-of select="$productname"/>
  	</a>
	<br />
	<xsl:apply-templates select="Authors"/><xsl:apply-templates select="Artists"/><br />

	<xsl:call-template name="ShowImg">
		<xsl:with-param name="img"><xsl:value-of select="$imgmedium"/>
		</xsl:with-param>
		<xsl:with-param name="asin"><xsl:value-of select="$asin"/>
		</xsl:with-param>
	</xsl:call-template>
	<br />
	
	

	<font size="-1">
	価格　<b><xsl:value-of select="$ourprice"/></b>　［　定価　<xsl:value-of select="$listprice"/>　］<br />
	<xsl:value-of select="$availavility"/><br />
	</font>

	<br />

	<xsl:apply-templates select="Reviews/AvgCustomerRating"/>
	<xsl:apply-templates select="Reviews/CustomerReview">
	  <xsl:sort select="Rating"/>
	</xsl:apply-templates>


	<br />
	<font size="-1">
	<a>
  	<xsl:attribute name="href">
  	<xsl:value-of select="concat($baseurl, $asin, '/goodpic-22/')" />
  	</xsl:attribute>
  	Amazonで詳しく見る
	</a>
	</font>

	<img src="http://www.goodpic.com/mt/images/spacer.gif" width="80" height="1" /><a href="http://www.goodpic.com/mt/aws/"><img src="http://www.goodpic.com/mt/aws/powered-by-gtool.gif" border="0" /></a><br />

<!-- End of No Table -->

<br />
</td>
</tr>

<tr>
<td valign="top" bgcolor="#ddddff" width="150">
<input type="radio" name="outType" value="simple" />　シンプル　
</td>
<td valign="top" width="550">

<!-- Start of Simple -->

	 <table border="0" cellpadding="5" width="550">
	 <tr><td valign="top" width="80">

	 <xsl:call-template name="ShowImg">
		<xsl:with-param name="img"><xsl:value-of select="$imgsmall"/>
		</xsl:with-param>
		<xsl:with-param name="asin"><xsl:value-of select="$asin"/>
		</xsl:with-param>
	</xsl:call-template>
	
	</td><td valign="top">

	<a>
  	<xsl:attribute name="href">
  	<xsl:value-of select="concat($baseurl, $asin, '/goodpic-22/')" />
  	</xsl:attribute>
  	<xsl:value-of select="$productname"/>
  	</a>
	<br />

	<xsl:apply-templates select="Authors"/><xsl:apply-templates select="Artists"/>
	<br />

	</td></tr></table>

<!-- End of Simple -->

</td></tr>
</table>

</xsl:template>

  <xsl:template match="Artists">
        <xsl:value-of select="Artist[1]"/>
	<br />
  </xsl:template>

  <xsl:template match="Authors">
    <xsl:choose>
      <xsl:when test="count(Author)&gt; 2">
        <xsl:for-each select="Author">
          <xsl:choose>
            <xsl:when test="not(position() = last())">
              <xsl:value-of select="."/>
              <xsl:text>, </xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="."/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
      </xsl:when>
      <xsl:when test="count(Author) = 2">
        <xsl:value-of select="Author[1]"/>
        <xsl:text> ， </xsl:text>
        <xsl:value-of select="Author[2]"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="Author"/>
      </xsl:otherwise>
    </xsl:choose>
	<br />
  </xsl:template>

  <xsl:template match="AvgCustomerRating">
	
        <font size="-1"><b>おすすめ平均　</b></font>
        <xsl:call-template name="Stars">
          <xsl:with-param name="average" select="."/>
        </xsl:call-template>
	<br />

  </xsl:template>

<xsl:template match="CustomerReview">
	<xsl:param name="decode">0</xsl:param>

	<xsl:choose>
	  <xsl:when test="$decode='0'">

        <xsl:call-template name="Stars">
        	<xsl:with-param name="average" select="Rating"/>
        </xsl:call-template>
        
	<xsl:text> </xsl:text>
	<font size="-1">
        <xsl:value-of select="Summary"/>
	</font>
        <br />

	  </xsl:when>
	  <xsl:otherwise>

	<xsl:text>#rating=</xsl:text>
        <xsl:value-of select="Rating"/>
        <xsl:text>&amp;sum=</xsl:text>
        <xsl:value-of select="Summary"/>

	  </xsl:otherwise>
	</xsl:choose>

</xsl:template>

  <xsl:template name="Stars">
    <xsl:param name="average" select="5"/>
    <xsl:choose>
      <xsl:when test="$average &gt; 4.75">
        <img src="http://g-images.amazon.com/images/G/01/detail/stars-5-0.gif"/>
      </xsl:when>
      <xsl:when test="$average &gt; 4.25">
        <img src="http://g-images.amazon.com/images/G/01/detail/stars-4-5.gif"/>
      </xsl:when>
      <xsl:when test="$average &gt; 3.75">
        <img src="http://g-images.amazon.com/images/G/01/detail/stars-4-0.gif"/>
      </xsl:when>
      <xsl:when test="$average &gt; 3.25">
        <img src="http://g-images.amazon.com/images/G/01/detail/stars-3-5.gif"/>
      </xsl:when>
      <xsl:when test="$average &gt; 2.75">
        <img src="http://g-images.amazon.com/images/G/01/detail/stars-3-0.gif"/>
      </xsl:when>
      <xsl:when test="$average &gt; 2.25">
        <img src="http://g-images.amazon.com/images/G/01/detail/stars-2-5.gif"/>
      </xsl:when>
      <xsl:when test="$average &gt; 1.75">
        <img src="http://g-images.amazon.com/images/G/01/detail/stars-2-0.gif"/>
      </xsl:when>
      <xsl:when test="$average &gt; 1.25">
        <img src="http://g-images.amazon.com/images/G/01/detail/stars-1-5.gif"/>
      </xsl:when>
      <xsl:when test="$average &gt; .75">
        <img src="http://g-images.amazon.com/images/G/01/detail/stars-1-0.gif"/>
      </xsl:when>
      <xsl:when test="$average &gt; .25">
        <img src="http://g-images.amazon.com/images/G/01/detail/stars-0-5.gif"/>
      </xsl:when>
      <xsl:otherwise>
        <img src="http://g-images.amazon.com/images/G/01/detail/stars-0-0.gif"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


<xsl:template name="ShowImg">

	<xsl:param name="asin"></xsl:param>
	<xsl:param name="img"></xsl:param>

  	<a>
  	<xsl:attribute name="href">
  	<xsl:value-of select="concat('http://www.amazon.co.jp/exec/obidos/ASIN/', $asin, '/goodpic-22/')" />
  	</xsl:attribute>
  	<img>
  	  <xsl:attribute name="src">
  	  <xsl:value-of select="$img"/>
  	  </xsl:attribute>
  	  <xsl:attribute name="border">0</xsl:attribute>
	</img>
  	</a>

</xsl:template>

</xsl:stylesheet>
