topical media & game development

talk show tell print

mashup-amazon-08-08-02-YahooREST-YahooWebTransform.xsl / xsl



  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:n="urn:yahoo:srch">
  <xsl:output method="html"/>
  <xsl:template match="/">    
    <h1>Yahoo Web Search Results</h1>
    <table>  
      <xsl:choose>
        <xsl:when test="n:ResultSet/n:Result">          
          <xsl:apply-templates select="n:ResultSet/n:Result"/>
          </xsl:when>
      <xsl:otherwise><!-- there are no children, time to search -->
        <span class="t">Sorry your search returned no results. Try widening your criteria.</span>
      </xsl:otherwise>
      </xsl:choose>
  </table>
  </xsl:template>  
    <xsl:template match="n:Result">
      <tr><td>
           <b><xsl:value-of select="n:Title" /></b><br/>
          <a target="_blank">
                  <xsl:attribute name="href">
                          <xsl:value-of select="n:ClickUrl" />
                  </xsl:attribute>                        
      <xsl:value-of select="n:Url" />
      </a><br/>      
        <xsl:value-of select="n:Summary" />
        <hr/>
    
      </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.