jcramalho

stylesheet ARQSITS

Oct 1st, 2018
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.22 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3.    version="2.0">
  4.    
  5.     <xsl:output method="html" indent="yes"/>
  6.    
  7.     <xsl:template match="/">
  8.         <html>
  9.             <head>
  10.                 <meta charset="UTF-8"/>
  11.             </head>
  12.             <body>
  13.                 <h1>Arqueossítios do NW Português</h1>
  14.                 <table width="100%">
  15.                     <tr>
  16.                         <td width="20%" valign="top">
  17.                             <h3><a name="indice">Índice</a></h3>
  18.                             <ul>
  19.                                 <xsl:apply-templates mode="indice" select="/ARQSITS/ARQELEM/IDENTI">
  20.                                     <xsl:sort select="."/>
  21.                                 </xsl:apply-templates>
  22.                             </ul>
  23.                         </td>
  24.                         <td width="80%">
  25.                             <xsl:apply-templates/>
  26.                         </td>
  27.                     </tr>
  28.                 </table>
  29.             </body>
  30.         </html>
  31.     </xsl:template>
  32.    
  33.     <!-- Templates para o índice -->
  34.    
  35.     <xsl:template match="text()" mode="indice" priority="-1"/>
  36.    
  37.     <xsl:template match="IDENTI" mode="indice">
  38.         <li>
  39.             <a href="#{generate-id()}">
  40.                 <xsl:value-of select="."/>
  41.             </a>
  42.         </li>
  43.     </xsl:template>
  44.    
  45.     <!-- Templates para o conteúdo -->
  46.    
  47.     <xsl:template match="ARQELEM">
  48.         <hr/>
  49.         <h2>
  50.             <a name="{generate-id(IDENTI)}">
  51.                 <xsl:value-of select="IDENTI"/>
  52.             </a>
  53.         </h2>
  54.         <h3><xsl:value-of select="DESCRI"/></h3>
  55.         <table border="1">
  56.             <tr><td>Lugar:</td><td><xsl:value-of select="LUGAR"/></td></tr>
  57.             <tr><td>Freguesia:</td><td><xsl:value-of select="FREGUE"/></td></tr>
  58.             <tr><td>Concelho:</td><td><xsl:value-of select="CONCEL"/></td></tr>
  59.         </table>
  60.         <p><xsl:value-of select="ACESSO"/></p>
  61.         <p><xsl:value-of select="QUADRO"/></p>
  62.         <p><xsl:value-of select="DESARQ"/></p>
  63.         <h6>[<a href="#indice">Voltar ao índice</a>]</h6>
  64.     </xsl:template>
  65. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment