Advertisement
Guest User

xsl

a guest
May 26th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.37 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  4. xmlns:ns="http://www.dei.isep.ipp.pt/lprog">
  5.  
  6. <xsl:output method="html"/>
  7.  
  8. <xsl:template match="/ns:relatório">
  9. <html>
  10. <head>
  11. <title>
  12. <xsl:value-of select="//ns:tema"/>
  13. </title>
  14. <link rel="stylesheet" type="text/css" href="estilo.css" />
  15. </head>
  16. <body style="margin-left: 7%; margin-right: 5%; font-family: arial; font-size: 12pt; background: #cce0ff">
  17. <xsl:apply-templates select="ns:páginaRosto"/>
  18. <br></br>
  19. <hr></hr>
  20. <br></br>
  21. <center>
  22. <h2>Alunos</h2>
  23. </center>
  24. <xsl:apply-templates select="//ns:autor"/>
  25. <br></br>
  26. <hr></hr>
  27. <br></br>
  28. <center>
  29. <h2>Indice</h2>
  30. </center>
  31. <xsl:apply-templates select="//ns:corpo"/>
  32. <br></br>
  33. <hr></hr>
  34. <br></br>
  35. <center>
  36. <h2>Introdução</h2>
  37. </center>
  38. <xsl:apply-templates select="//ns:introdução"/>
  39. <br></br>
  40. <hr></hr>
  41. <br></br>
  42. <center>
  43. <h2>Análise</h2>
  44. </center>
  45. <xsl:apply-templates select="//ns:análise"/>
  46. <br></br>
  47. <hr></hr>
  48. <br></br>
  49. <center>
  50. <h2>Linguagem</h2>
  51. </center>
  52. <xsl:apply-templates select="//ns:linguagem"/>
  53. <br></br>
  54. <hr></hr>
  55. <br></br>
  56. <center>
  57. <h2>Transformações</h2>
  58. </center>
  59. <xsl:apply-templates select="//ns:transformações"/>
  60. <br></br>
  61. <hr></hr>
  62. <br></br>
  63. <center>
  64. <h2>Conclusão</h2>
  65. </center>
  66. <xsl:apply-templates select="//ns:conclusão"/>
  67. <br></br>
  68. <hr></hr>
  69. <br></br>
  70. <center>
  71. <h2>Bibliografia</h2>
  72. </center>
  73. <xsl:apply-templates select="//ns:referências"/>
  74. <br></br>
  75. <hr></hr>
  76. <br></br>
  77. <center>
  78. <h2>Anexos</h2>
  79. </center>
  80. <xsl:apply-templates select="//ns:anexos"/>
  81. </body>
  82. </html>
  83. </xsl:template>
  84.  
  85. <xsl:template match="ns:páginaRosto">
  86. <center>
  87. <xsl:element name="img">
  88. <xsl:attribute name="src">
  89. <xsl:value-of select="ns:logotipoDEI"/>
  90. </xsl:attribute>
  91. <xsl:attribute name="heigth">400</xsl:attribute>
  92. <xsl:attribute name="width">400</xsl:attribute>
  93. </xsl:element>
  94. <xsl:apply-templates select="//ns:disciplina"/>
  95. <br></br>
  96. <h3>
  97. <xsl:value-of select="ns:tema"/>
  98. </h3>
  99. <br></br>
  100. <br></br>
  101. <b>Turma: </b>
  102. <xsl:value-of select="ns:turma"/>
  103. <br></br>
  104. <br></br>
  105. <b>Docentes:</b>
  106. <br></br>
  107. <xsl:apply-templates select="ns:professor"/>
  108. <br></br>
  109. <xsl:value-of select="ns:data"/>
  110. </center>
  111. </xsl:template>
  112.  
  113. <xsl:template match="ns:disciplina">
  114. <br></br>
  115. <h2>
  116. <xsl:value-of select="ns:designação"/> -
  117. <xsl:value-of select="ns:sigla"/>
  118. </h2>
  119. </xsl:template>
  120.  
  121. <xsl:template match="ns:professor">
  122. <br>
  123. <xsl:value-of select="@sigla"/> -
  124. <xsl:value-of select="@tipoAula"/>
  125. </br>
  126. </xsl:template>
  127.  
  128. <xsl:template match="ns:autor">
  129. <center>
  130. <xsl:value-of select="ns:nome"/> -
  131. <xsl:value-of select="ns:número"/> -
  132. <xsl:value-of select="ns:mail"/>
  133. </center>
  134. <br></br>
  135. </xsl:template>
  136.  
  137. <xsl:template match="ns:corpo">
  138. <center>
  139. <h3>
  140. <xsl:value-of select="ns:introdução/@tituloSecção"/>
  141. </h3>
  142. <xsl:apply-templates select="ns:outrasSecções"/>
  143. <h3>
  144. <xsl:value-of select="ns:conclusão/@tituloSecção"/>
  145. </h3>
  146. <h3>
  147. <xsl:value-of select="ns:referências/@tituloSecção"/>
  148. </h3>
  149. <h3>
  150. <xsl:value-of select="//ns:anexos/@tituloSecção"/>
  151. </h3>
  152. </center>
  153. </xsl:template>
  154.  
  155. <xsl:template match="ns:outrasSecções">
  156. <center>
  157. <h3>
  158. <xsl:value-of select="ns:análise/@tituloSecção"/>
  159. </h3>
  160. <h3>
  161. <xsl:value-of select="ns:linguagem/@tituloSecção"/>
  162. </h3>
  163. <h3>
  164. <xsl:value-of select="ns:transformações/@tituloSecção"/>
  165. </h3>
  166. </center>
  167. </xsl:template>
  168.  
  169. <xsl:template match="ns:introdução">
  170. <p style="text-align: justify; padding-left: 5%; padding-reight: 5%">
  171. <xsl:for-each select="ns:parágrafo">
  172. <p>
  173. <xsl:value-of select="."/>
  174. </p>
  175. </xsl:for-each>
  176. </p>
  177. </xsl:template>
  178.  
  179. <xsl:template match="ns:análise">
  180. <p style="text-align: justify; padding-left: 5%; padding-reight: 5%">
  181. <xsl:for-each select="ns:parágrafo">
  182. <p>
  183. <xsl:value-of select="."/>
  184. </p>
  185. </xsl:for-each>
  186. </p>
  187. </xsl:template>
  188.  
  189. <xsl:template match="ns:linguagem">
  190. <br></br>
  191. <xsl:if test="./*=ns:parágrafo">
  192. <p style="text-align: justify; padding-left: 5%; padding-reight: 5%">
  193. <p>
  194. <xsl:value-of select="."/>
  195. </p>
  196. </p>
  197. </xsl:if>
  198. <br></br>
  199. <br></br>
  200. <xsl:if test="./*=ns:codigo">
  201. <p style="text-align: justify; padding-left: 5%; padding-reight: 5%">
  202. <p>
  203. <xsl:value-of select="ns:bloco"/>
  204. </p>
  205. </p>
  206. </xsl:if>
  207. </xsl:template>
  208.  
  209. <xsl:template match="ns:transformações">
  210. <p style="text-align: justify; padding-left: 5%; padding-reight: 5%">
  211. <xsl:for-each select="ns:parágrafo">
  212. <p>
  213. <xsl:value-of select="."/>
  214. </p>
  215. </xsl:for-each>
  216. </p>
  217. </xsl:template>
  218. <xsl:template match="ns:conclusão">
  219. <p style="text-align: justify; padding-left: 5%; padding-reight: 5%">
  220. <xsl:for-each select="ns:parágrafo">
  221. <p>
  222. <xsl:value-of select="."/>
  223. </p>
  224. </xsl:for-each>
  225. </p>
  226. </xsl:template>
  227.  
  228. <xsl:template match="ns:referências">
  229. <xsl:apply-templates select="ns:refWeb"/>
  230. </xsl:template>
  231.  
  232. <xsl:template match="ns:refWeb">
  233. <xsl:value-of select="ns:URL"/> -
  234. <xsl:value-of select="ns:descrição"/>
  235. <br></br>
  236. </xsl:template>
  237.  
  238. <xsl:template match="ns:anexos">
  239. <center>
  240. <xsl:for-each select="ns:figura">
  241. <xsl:element name="img">
  242. <xsl:attribute name="src">
  243. <xsl:value-of select="@src"/>
  244. </xsl:attribute>
  245. <xsl:attribute name="heigth">300</xsl:attribute>
  246. <xsl:attribute name="width">300</xsl:attribute>
  247. </xsl:element>
  248. <p>
  249. <xsl:value-of select="@descrição"/>
  250. </p>
  251. <br></br>
  252. <br></br>
  253. </xsl:for-each>
  254. </center>
  255. </xsl:template>
  256.  
  257. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement