Resolução do Exercício 6 de GOII

 

  1. XML

     

    <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    <?xml-stylesheet type="text/xsl" href="filmes1.xsl"?>
    <!DOCTYPE catalogo SYSTEM "filmes.dtd">
    (...)

    XSL

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
    <xsl:template match="/">
    <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="/catalogo">
    <html>
    <head>
    <title>Catalogo de Filmes</title>
    </head>
    <body>
    <ul>
    <xsl:apply-templates select="filme"/>
    </ul>
    </body>
    </html>
    </xsl:template>
    
    <xsl:template match="filme">
    <li><xsl:value-of select="@ano"/> -
    <xsl:apply-templates select="titulo"/>
    </li>
    </xsl:template>
    
    <xsl:template match="titulo">
    <xsl:apply-templates/>
    </xsl:template>
    
    <xsl:template match="titulo/original">
    <xsl:value-of select="."/>
    </xsl:template>
    <xsl:template match="titulo/portugues">
    (<xsl:value-of select="."/>)
    </xsl:template>
    
    </xsl:stylesheet>


    ver resultado

     

  2. XML

     

    <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    <?xml-stylesheet type="text/xsl" href="filmes2.xsl"?>
    <!DOCTYPE catalogo SYSTEM "filmes.dtd">
    (...)

    XSL

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
        <xsl:template match="/">
    	<xsl:apply-templates/>
        </xsl:template>
    
        <xsl:template match="catalogo">
          <html>
            <head>
              <title>Catalogo de Filmes</title>
            </head>
            <body>
              <xsl:apply-templates select="filme"/>
            </body>
          </html>
        </xsl:template>
    
        <xsl:template match="filme">
    	<h3><xsl:apply-templates select="titulo"/></h3>
    	<xsl:apply-templates select="realizadores"/>
    	<xsl:apply-templates select="argumentistas"/>
    	<xsl:apply-templates select="actores"/>
    <hr/>
    </xsl:template>
    
        <xsl:template match="titulo">
    		<xsl:apply-templates/>
       </xsl:template>
    
        <xsl:template match="titulo/original">
    		<xsl:value-of select="."/><br/>
       </xsl:template>
    
        <xsl:template match="titulo/portugues">
    		(<xsl:value-of select="."/>)
       </xsl:template>
    
        <xsl:template match="realizadores">
    	<br/>
    	<b>Realizadores:</b>	
    	<br/>
              <xsl:apply-templates select="realizador"/>
        </xsl:template>
    
        <xsl:template match="realizador">
              <xsl:value-of select="."/><br/>
        </xsl:template>
    
        <xsl:template match="argumentistas">
    	<br/>
    	<b>Argumentistas:</b>
    	<br/>	
              <xsl:apply-templates select="argumentista"/>
        </xsl:template>
    
        <xsl:template match="argumentista">
              <xsl:value-of select="."/><br/>
        </xsl:template>
    
        <xsl:template match="actores">
    	<br/>
    	<b>Actores:</b>
    	<br/>
              <xsl:apply-templates select="actor"/>
        </xsl:template>
    
        <xsl:template match="actor">
              <xsl:value-of select="."/><br/>
        </xsl:template>
    
    </xsl:stylesheet>

    ver resultado

    Usando CSS

     

    (...)
    <xsl:template match="catalogo">
    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="../../fds.css"/>
    <title>Catalogo de Filmes</title>
    </head>
    <body>
    <xsl:apply-templates select="filme"/>
    </body>
    </html>
    </xsl:template>
    (...)

    ver resultado

     

  3. XML

     

    <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    <?xml-stylesheet type="text/xsl" href="filmes3.xsl"?>
    <!DOCTYPE catalogo SYSTEM "filmes.dtd">
    (...)

    XSL

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
        <xsl:template match="/">
    	<xsl:apply-templates/>
        </xsl:template>
    
        <xsl:template match="catalogo">
          <html>
            <head>
              <title>Catalogo de Filmes</title>
            </head>
            <body>
              <xsl:apply-templates select="filme"/>
            </body>
          </html>
        </xsl:template>
    
        <xsl:template match="filme">
          <table>
          <tr><td colspan="2">
    	<h3><xsl:apply-templates select="titulo"/></h3>
    	</td>
    	</tr>	
    	<tr><td><b>Ano:</b></td><td><xsl:value-of select="@ano"/></td></tr>
    	<xsl:apply-templates select="realizadores"/>
    	<xsl:apply-templates select="argumentistas"/>
    	<xsl:apply-templates select="actores"/>
          </table>
    </xsl:template>
    
        <xsl:template match="titulo">
    		<xsl:apply-templates/>
       </xsl:template>
    
        <xsl:template match="titulo/original">
    		<xsl:value-of select="."/><br/>
       </xsl:template>
    
        <xsl:template match="titulo/portugues">
    		(<xsl:value-of select="."/>)
       </xsl:template>
    
        <xsl:template match="realizadores">
    	<tr>
    	<td><b>Realizadores:</b>	
    	</td>
    	<td>
              <xsl:apply-templates select="realizador"/>
    	</td>
    	</tr>
        </xsl:template>
    
        <xsl:template match="realizador">
              <xsl:value-of select="."/><br/>
        </xsl:template>
    
        <xsl:template match="argumentistas">
    	<tr>
    	<td><b>Argumentistas:</b>	
    	</td>
    	<td>
              <xsl:apply-templates select="argumentista"/>
    	</td>
    	</tr>
        </xsl:template>
    
        <xsl:template match="argumentista">
              <xsl:value-of select="."/><br/>
        </xsl:template>
    
        <xsl:template match="actores">
    	<tr>
    	<td><b>Actores:</b>	
    	</td>
    	<td>
              <xsl:apply-templates select="actor"/>
    	</td>
    	</tr>
        </xsl:template>
    
        <xsl:template match="actor">
              <xsl:value-of select="."/><br/>
        </xsl:template>
    
    </xsl:stylesheet>
     

    ver resultado

     

  4.  
    1. XML

       

      <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
      <?xml-stylesheet type="text/xsl" href="filmes4a.xsl"?>
      <!DOCTYPE catalogo SYSTEM "filmes.dtd">
      (...)

      XSL

      (...)
      <xsl:template match="catalogo">
      <html>
      <head>
      <title>Catalogo de Filmes</title>
      </head>
      <body>
      <xsl:apply-templates select="filme[titulo/portugues='A Mumia']"/>
      </body>
      </html>
      </xsl:template>
      (...)
       

      ver resultado

       

    2. XML

       

      <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
      <?xml-stylesheet type="text/xsl" href="filmes4b.xsl"?>
      <!DOCTYPE catalogo SYSTEM "filmes.dtd">
      (...)

      XSL

      (...)
      <xsl:template match="catalogo">
      <html>
      <head>
      <title>Catalogo de Filmes</title>
      </head>
      <body>
      <xsl:apply-templates select="filme[@ano='2000']"/>
      </body>
      </html>
      </xsl:template>
      (...)
       

      ver resultado