jcramalho

Obra.xsl

Nov 9th, 2015
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.25 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"
  3.  version="1.0">
  4.  
  5.   <xsl:template match="obra">
  6.       <html>
  7.         <body>
  8.             <xsl:call-template name="show-meta"/>
  9.           <address>[<a href="gestaoObras.html">Voltar ao menu principal</a>]</address>
  10.         </body>
  11.       </html>
  12.    
  13.  
  14.   </xsl:template>
  15.  
  16.   <!-- ...................Mostra a metainformação da obra............... -->
  17.  
  18.   <xsl:template name="show-meta">
  19.     <h1>
  20.       <xsl:value-of select="titulo"/>
  21.     </h1>
  22.     <table border="1">
  23.       <tr>
  24.         <td>Código: </td>
  25.         <td><xsl:value-of select="@id"/></td>
  26.       </tr>
  27.       <tr>
  28.         <td>Título: </td>
  29.         <td><xsl:value-of select="titulo"/></td>
  30.       </tr>
  31.       <xsl:if test="subtitulo">
  32.         <tr>
  33.           <td>Subtítulo: </td>
  34.           <td><xsl:value-of select="subtitulo"/></td>
  35.         </tr>
  36.       </xsl:if>
  37.       <xsl:if test="tipo">
  38.         <tr>
  39.           <td>Tipo/Classe: </td>
  40.           <td><xsl:value-of select="tipo"/></td>
  41.         </tr>
  42.       </xsl:if>
  43.       <xsl:if test="desc">
  44.         <tr>
  45.           <td>Descrição: </td>
  46.           <td><xsl:apply-templates select="desc/*"/></td>
  47.         </tr>
  48.       </xsl:if>
  49.       <xsl:if test="compositor">
  50.         <tr>
  51.           <td>Compositor: </td>
  52.           <td><xsl:value-of select="compositor"/></td>
  53.         </tr>
  54.       </xsl:if>
  55.       <xsl:if test="arranjo">
  56.         <tr>
  57.           <td>Arranjo: </td>
  58.           <td><xsl:value-of select="arranjo"/></td>
  59.         </tr>
  60.       </xsl:if>
  61.       <xsl:if test="inf-relacionada">
  62.         <tr>
  63.           <td>Media: </td>
  64.           <td><xsl:apply-templates select="inf-relacionada"/></td>
  65.         </tr>
  66.       </xsl:if>
  67.     </table>
  68.   </xsl:template>
  69.  
  70.   <xsl:template match="para">
  71.     <p>
  72.       <xsl:value-of select="."/>
  73.     </p>
  74.   </xsl:template>
  75.  
  76.   <!-- ...................Trata os videos................................ -->
  77.  
  78.   <xsl:template match="video">
  79.         <iframe width="200" height="150" src="https://www.youtube.com/embed/{substring-after(@href,'v=')}" frameborder="0"
  80.          allowfullscreen="1">.</iframe>  
  81.   </xsl:template>
  82.  
  83. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment