topical media & game development

talk show tell print

basic-ajax-08-Example.xsl / xsl



  <?xml version="1.0" encoding="utf-8"?>
  
  <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
    <xsl:output 
      method="html" 
      indent="yes" 
      version="4.0" />
     
    <xsl:template match="/">
      <table border="1">
        <xsl:for-each select="//hotel">
          <xsl:choose>
            <xsl:when test="number(price)&lt; 175">
              <tr >
                <td>
                  <xsl:value-of select="name"/>
                </td>
                <td style="background:red">
                  <xsl:value-of select="price"/>
                </td>
              </tr>
            </xsl:when>
            <xsl:otherwise>
              <tr>
                <td>
                  <xsl:value-of select="name"/>
                </td>
                <td>
                  <xsl:value-of select="price"/>
                </td>
              </tr>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
      </table>
    </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.