jcramalho

BOM stylesheet

Oct 11th, 2018
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 6.15 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.         <xsl:result-document href="bomWebsite/index.html">
  9.             <html>
  10.                 <head>
  11.                     <meta charset="UTF-8"/>
  12.                     <title>BOM</title>
  13.                     <link rel="stylesheet" href="w3.css"/>
  14.                 </head>
  15.                 <body>
  16.                     <div class="w3-container w3-padding">
  17.                     <div class="w3-row">
  18.                         <div class="w3-col m4 l3">
  19.                             <h3>Table of Contents</h3>
  20.                             <ul class="w3-ul">
  21.                                 <li><a href="titlepage.html">Title Page</a></li>
  22.                                 <li><a href="preface.html">Preface</a></li>
  23.                                 <li>Books:<ul class="w3-ul w3-hoverable">
  24.                                     <xsl:apply-templates select="//book"/>  
  25.                                 </ul></li>
  26.                             </ul>
  27.                         </div>
  28.                         <div class="w3-col m8 l9">
  29.                             <div class="w3-container">
  30.                                 <h1><xsl:value-of select="tstmt/coverpg/title"/></h1>
  31.                                 <h2><xsl:value-of select="tstmt/coverpg/title2"/></h2>
  32.                                 <h3 class="w3-border">
  33.                                     <xsl:for-each select="tstmt/coverpg/subtitle[1]/p">
  34.                                         <p><xsl:value-of select="."/></p>
  35.                                     </xsl:for-each>
  36.                                 </h3>
  37.                                 <h3 class="w3-border">
  38.                                     <xsl:for-each select="tstmt/coverpg/subtitle[2]/p">
  39.                                         <p><xsl:value-of select="."/></p>
  40.                                     </xsl:for-each>
  41.                                 </h3>
  42.                             </div>
  43.                         </div>
  44.                     </div>
  45.                     </div>
  46.                 </body>
  47.             </html>
  48.         </xsl:result-document>
  49.        
  50.         <xsl:apply-templates select="//book" mode="páginas"/>
  51.     </xsl:template>
  52.    
  53.     <xsl:template match="book">
  54.         <li>
  55.             <a href="book{count(preceding-sibling::book)+1}.html">
  56.                 <xsl:value-of select="bktshort"/>
  57.             </a>
  58.         </li>
  59.     </xsl:template>
  60.    
  61.     <xsl:template match="book" mode="páginas">
  62.         <xsl:result-document href="bomWebsite/book{count(preceding-sibling::book)+1}.html">
  63.             <html>
  64.                 <head>
  65.                     <meta charset="UTF-8"/>
  66.                     <title>Book page</title>
  67.                     <link rel="stylesheet" href="w3.css"/>
  68.                 </head>
  69.                 <body>
  70.                     <div class="w3-container w3-padding">
  71.                         <a name="top"/>
  72.                         <div class="w3-row">
  73.                             <div class="w3-col m4 l3">
  74.                                 <div class="w3-container">
  75.                                     <h3><xsl:value-of select="bktshort"/> TOC</h3>
  76.                                     <ul class="w3-ul w3-hoverable">
  77.                                         <xsl:for-each select="chapter">
  78.                                             <li>
  79.                                                 <a href="#{generate-id()}">
  80.                                                     <xsl:value-of select="chtitle"/>
  81.                                                 </a>
  82.                                             </li>
  83.                                         </xsl:for-each>
  84.                                     </ul>
  85.                                     <hr/>
  86.                                     <div class="w3-panel w3-green">
  87.                                         <h4 class="w3-opacity">
  88.                                             <a href="index.html">
  89.                                                 Back to main page
  90.                                             </a>
  91.                                         </h4>
  92.                                     </div>
  93.                                    
  94.                                 </div>
  95.                             </div>
  96.                             <div class="w3-col m8 l9">
  97.                                 <h1><xsl:value-of select="bktlong"/></h1>
  98.                                 <div class="w3-container w3-border">
  99.                                     <xsl:for-each select="bksum/p">
  100.                                         <p><xsl:value-of select="."/></p>
  101.                                     </xsl:for-each>
  102.                                 </div>
  103.                                 <xsl:apply-templates select="chapter" mode="páginas"/>
  104.                             </div>
  105.                         </div>
  106.                     </div>
  107.                 </body>
  108.             </html>
  109.         </xsl:result-document>
  110.     </xsl:template>
  111.    
  112.     <xsl:template match="chapter" mode="páginas">
  113.         <div class="w3-card-4">
  114.             <a name="{generate-id()}"/>
  115.             <header class="w3-container w3-teal">
  116.                 <h1><xsl:value-of select="chtitle"/></h1>
  117.             </header>
  118.            
  119.             <div class="w3-container">
  120.                 <div class="w3-container w3-border">
  121.                     <xsl:for-each select="chsum/p">
  122.                         <p><xsl:value-of select="."/></p>
  123.                     </xsl:for-each>
  124.                 </div>
  125.                 <xsl:for-each select="v">
  126.                     <p><xsl:value-of select="."/></p>
  127.                 </xsl:for-each>
  128.             </div>
  129.            
  130.             <footer class="w3-container w3-teal">
  131.                 <address>End of chapter <xsl:value-of select="count(preceding-sibling::chapter)+1"/></address>
  132.                 <address><a href="#top">Back to top</a></address>
  133.             </footer>
  134.            
  135.         </div>
  136.     </xsl:template>
  137.    
  138.    
  139.    
  140.    
  141.    
  142.    
  143.    
  144.    
  145.    
  146.    
  147. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment