<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aws="http://webservices.amazon.com/AWSECommerceService/2006-03-08" exclude-result-prefixes="aws" version="1.0">
<xsl:output method="html"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />

<xsl:template match="/">
    <html lang="ja">
        <head>
            <link rel="stylesheet" href="http://perltips.twinkle.cc/files/sites/perltips/xsl/styles-xsl.css" type="text/css" media="screen,tv" />
            <link rel="shortcut icon" href="http://perltips.twinkle.cc/favicon.ico" />
        </head>
        <body>
            <xsl:apply-templates select="aws:ItemLookupResponse/aws:Items/aws:Item" />
        </body>
    </html>
</xsl:template>

    <xsl:template match="aws:Item">

        <xsl:variable name="detail"       select="aws:DetailPageURL"                />
        <xsl:variable name="image"        select="aws:MediumImage/aws:URL"          />
        <xsl:variable name="width"        select="aws:MediumImage/aws:Width"        />
        <xsl:variable name="height"       select="aws:MediumImage/aws:Height"       />
        <xsl:variable name="title"        select="aws:ItemAttributes/aws:Title"     />
        <xsl:variable name="ourprice"     select="aws:Offers/aws:Offer/aws:OfferListing/aws:Price/aws:FormattedPrice" />
        <xsl:variable name="availavility" select="aws:Offers/aws:Offer/aws:OfferListing/aws:Availability" />

        <table>
            <tr>
                <td>
                    <a>
                        <xsl:attribute name="href"  ><xsl:value-of select="$detail" /></xsl:attribute>
                        <xsl:attribute name="target">_blank</xsl:attribute>
                        <img>
                            <xsl:attribute name="src"   ><xsl:value-of select="$image"  /></xsl:attribute>
                            <xsl:attribute name="height"><xsl:value-of select="$height" /></xsl:attribute>
                            <xsl:attribute name="width" ><xsl:value-of select="$width"  /></xsl:attribute>
                            <xsl:attribute name="alt"   ><xsl:value-of select="$title"  /></xsl:attribute>
                            <xsl:attribute name="title" ><xsl:value-of select="$title"  /></xsl:attribute>
                        </img>
                    </a>
                </td>
                <td>
                    <a>
                        <xsl:attribute name="href"  ><xsl:value-of select="$detail" /></xsl:attribute>
                        <xsl:attribute name="target">_blank</xsl:attribute>
                        <xsl:value-of select="$title" /></a><br /><br />

                   <xsl:choose>
                       <xsl:when test="aws:ItemAttributes/aws:Author">
                           <xsl:value-of select="aws:ItemAttributes/aws:Author" />
                       </xsl:when>
                       <xsl:when test="aws:ItemAttributes/aws:Artist">
                           <xsl:value-of select="aws:ItemAttributes/aws:Artist" />
                       </xsl:when>
                       <xsl:when test="aws:ItemAttributes/aws:Director">
                           <xsl:value-of select="aws:ItemAttributes/aws:Director" />
                       </xsl:when>
                       <xsl:when test="aws:ItemAttributes/aws:Composer">
                            <xsl:value-of select="aws:ItemAttributes/aws:Composer" />
                        </xsl:when>
                        <xsl:when test="aws:ItemAttributes/aws:Manufacturer">
                            <xsl:value-of select="aws:ItemAttributes/aws:Manufacturer" />
                        </xsl:when>
                    </xsl:choose>
                    <xsl:choose>

                    <xsl:when test="aws:ItemAttributes/aws:Author">
                        <xsl:if test="aws:ItemAttributes/aws:Publisher"><br /><xsl:value-of select="aws:ItemAttributes/aws:Publisher" />
                        <xsl:if test="aws:ItemAttributes/aws:PublicationDate">
                        </xsl:if>
                            (<xsl:value-of select="aws:ItemAttributes/aws:PublicationDate" />)</xsl:if>
                    </xsl:when>
                    <xsl:when test="aws:ItemAttributes/aws:ReleaseDate"><br /><xsl:value-of select="aws:ItemAttributes/aws:ReleaseDate" />
                    </xsl:when>
                    </xsl:choose>

                    <div id="price">
                        <xsl:value-of select="$ourprice"/><br />
                    </div>
                    <xsl:value-of select="$availavility" /><br />
                    <div id="more">
                        <a>
                            <xsl:attribute name="href"  ><xsl:value-of select="$detail" /></xsl:attribute>
                            <xsl:attribute name="target">_blank</xsl:attribute>
                            <br />Amazon で詳しく見る</a>
                    </div>
                </td>
            </tr>
        </table>
    </xsl:template>

</xsl:stylesheet>
