vendredi 23 octobre 2015

IF on xlst not working

I've been bashing my head against a wall for the last hour trying to figure out why the if is not working, I need a fresh set of eyes to tell me what I am missing on the logic. The if starts just after line 25. It shoudl work, honestly it follows the example in: http://ift.tt/1Gw9knx But it does nothing!

Please look bellow:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
    <xsl:output method="html" indent="yes"/>
        
  <xsl:template match="/">
    <html>
        <!-- Background image -->
      <body background="bgimage.jpg">
                
        <h2 style="color:#47B2B2">My Movie Collection</h2>
        <!-- set border, color, and padding-->
        <table border="1" bgcolor="#0A1A1A" cellpadding="5">
          <tr bgcolor="#1F4C4C">
                  <!-- Set order -->
            <th>Title</th>
            <th>Director</th>
                        <th>Year</th>
                        <th>Genre</th>
                        <th>ID</th>
          </tr>
          <xsl:for-each select="movies/movie">
                  <!-- Sort by title -->
            <xsl:sort select="title"/>
                        <xsl:if test="year>2005">
            <tr bgcolor="#3D9999">
                        
                          <td>
                                <!-- Look for link, target to blank, the link text is the tittle pulled from xml -->
                <a href="{link}" target="_blank"><xsl:value-of select="title"/></a>
              </td>
                          
              <td>
                            <xsl:value-of select="director"/>
                          </td>
                          
                          <td>
                <xsl:value-of select="year"/>
              </td>
                          
                          <td>
                <xsl:value-of select="genre"/>
              </td>
                          
                          <td>
                <xsl:value-of select="movieID"/>
              </td>
                         </tr>
                        <xsl:if/>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>
  
  
  
  
</xsl:stylesheet>

Aucun commentaire:

Enregistrer un commentaire