topical media & game development
mashup-amazon-08-08-03-AmazonYahoo-AmazonYahoo.xsl / xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml"
xmlns:tns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:a="http://webservices.amazon.com/AWSECommerceService/2005-10-05"
xmlns:y="urn:yahoo:prods">
<xsl:output method="html"/>
<xsl:template match="/">
<table>
<tr>
<td width="50%">
<h2>Results from Amazon</h2>
</td>
<td width="50%">
<h2>Results from Yahoo</h2>
</td>
</tr>
<tr>
<td valign="top">
<xsl:apply-templates select="MashupRoot/a:ItemSearchResponse/a:Items"/>
</td>
<td valign="top">
<xsl:apply-templates select="MashupRoot/y:ResultSet/y:Result"/>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="a:Items">
<table>
<xsl:apply-templates select="a:Item"/>
</table>
</xsl:template>
<xsl:template match="y:Result">
<table>
<xsl:apply-templates select="y:Catalog"/>
</table>
</xsl:template>
<xsl:template match="a:Item">
<tr>
<td>
<img>
<xsl:attribute name="src">
<xsl:value-of select="a:SmallImage/a:URL" />
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="a:ItemAttributes/a:Title" />
</xsl:attribute>
<xsl:attribute name="align">left</xsl:attribute>
</img>
<a>
<xsl:attribute name="href">
<xsl:value-of select="a:DetailPageURL" />
</xsl:attribute>
<xsl:value-of select="a:ItemAttributes/a:Title" />
</a>
<br/>
<xsl:apply-templates select="a:OfferSummary"/>
<br/>
</td>
</tr>
</xsl:template>
<xsl:template match="a:OfferSummary">
<b>Lowest Price: </b><xsl:value-of select="a:LowestNewPrice/a:FormattedPrice" /><br/>
<b>Total New: </b><xsl:value-of select="a:TotalNew" /> <br/>
<b>Total Used: </b><xsl:value-of select="a:TotalUsed" />
</xsl:template>
<!-- Yahoo templates follow -->
<xsl:template match="y:Catalog">
<tr>
<td>
<img>
<xsl:attribute name="src">
<xsl:value-of select="y:Thumbnail/y:Url" />
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="y:ProductName" />
</xsl:attribute>
<xsl:attribute name="align">left</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="y:Thumbnail/y:Width" />
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="y:Thumbnail/y:Height" />
</xsl:attribute>
</img>
<a>
<xsl:attribute name="href">
<xsl:value-of select="y:Url" />
</xsl:attribute>
<xsl:value-of select="y:ProductName" />
</a><br/>
Prices from <xsl:value-of select="y:PriceTo"/><br/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.