Advertisement
moreiramota

Untitled

May 19th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.16 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <!--
  4. Document : AllClienteData.xsl
  5. Created on : 19 de Maio de 2019, 17:11
  6. Author : morei
  7. Description:
  8. Purpose of transformation follows.
  9. -->
  10. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  11. <xsl:output method="html"/>
  12. <xsl:template match="/casos">
  13. <html>
  14. <body>
  15. <table>
  16. <tr bgcolor="#9acd32">
  17. <th>Nome do Cliente</th>
  18. <th>Nome do objeto</th>
  19. <th>Morada</th>
  20. <th>Coberturas</th>
  21. <th>Valor Prémio</th>
  22. <th>Vigência</th>
  23. <th>Incidências</th>
  24. </tr>
  25. <tr>
  26. <xsl:apply-templates select="cliente"/>
  27. </tr>
  28. </table>
  29. </body>
  30. </html>
  31. </xsl:template>
  32.  
  33. <xsl:template match="cliente">
  34. <td>
  35. <h5>Nome:
  36. <xsl:apply-templates select="nome"/>
  37. </h5>
  38. </td>
  39. <h5>Objetos:
  40. <xsl:apply-templates select="objetos"/>
  41. </h5>
  42. </xsl:template>
  43.  
  44. <xsl:template match="nome">
  45. <h6>
  46. <xsl:value-of select="primeiro"/>
  47. <xsl:value-of select="apelido"/>
  48. </h6>
  49. </xsl:template>
  50.  
  51. <xsl:template match="objetos">
  52. <h6>Objecto
  53. <xsl:apply-templates select="objeto"/>
  54. </h6>
  55. </xsl:template>
  56.  
  57.  
  58.  
  59. <xsl:template match="objeto">
  60. <td>
  61. <h6>
  62. Nome Objeto
  63. <xsl:value-of select="nomeObjeto"/>
  64. </h6>
  65. </td>
  66. <td>
  67. <h6>
  68. Morada Objeto
  69. <xsl:apply-templates select="moradaObjeto"/>
  70. </h6>
  71. </td>
  72. <td>
  73. <h6>
  74. Coberturas Objeto
  75. <xsl:apply-templates select="coberturas"/>
  76. </h6>
  77. </td>
  78. <td>
  79. <h6>
  80. Valor Premio Objeto
  81. <xsl:value-of select="valorPremio"/>
  82. </h6>
  83. </td>
  84. <td>
  85. <h6>
  86. Vigencia Objeto
  87. <xsl:apply-templates select="vigencia"/>
  88. </h6>
  89. </td>
  90. <td>
  91. <h6>
  92. Ocurencias Objeto
  93. <xsl:apply-templates select="ocurrencias"/>
  94. </h6>
  95. </td>
  96. </xsl:template>
  97.  
  98.  
  99. <xsl:template match="coberturas">
  100. <h6>
  101. Cobertura
  102. <xsl:apply-templates select="cobertura"/>
  103. </h6>
  104. </xsl:template>
  105.  
  106.  
  107. <xsl:template match="cobertura">
  108. <h6>Nome Cobertura
  109. <xsl:value-of select="@cobertura"/>
  110. </h6>
  111. <h6>Descricao
  112. <xsl:value-of select="descricao"/>
  113. </h6>
  114. </xsl:template>
  115.  
  116.  
  117. <xsl:template match="moradaObjeto">
  118. <h6>Rua:
  119. <xsl:value-of select="rua"/>
  120. </h6>
  121. <h6>
  122. Porta:
  123. <xsl:value-of select="porta"/>
  124. </h6>
  125. <h6>
  126. Localidade:
  127. <xsl:value-of select="localidade"/>
  128. </h6>
  129. <h6>
  130. Pais:
  131. <xsl:value-of select="pais"/>
  132. </h6>
  133. <h6>
  134. Codigo Postal:
  135. <xsl:value-of select="codigo_postal"/>
  136. </h6>
  137. </xsl:template>
  138.  
  139. <xsl:template match="vigencia">
  140. <tr>
  141. <h5>Data inicio
  142. <xsl:apply-templates select="dataInicio"/>
  143. </h5>
  144. <h5>Data fim
  145. <xsl:apply-templates select="dataFim"/>
  146. </h5>
  147. </tr>
  148. </xsl:template>
  149.  
  150. <xsl:template match="dataInicio">
  151. <xsl:if test="dataInicio/mes=05">
  152. <tr>
  153. <h5>Ano
  154. <xsl:value-of select="ano"/>
  155. </h5>
  156. <h5>Mes
  157. <xsl:value-of select="mes"/>
  158. </h5>
  159. <h5>Dia
  160. <xsl:value-of select="dia"/>
  161. </h5>
  162. </tr>
  163. </xsl:if>
  164. </xsl:template>
  165.  
  166. <xsl:template match="dataFim">
  167. <tr>
  168. <h5>Ano
  169. <xsl:value-of select="ano"/>
  170. </h5>
  171. <h5>Mes
  172. <xsl:value-of select="mes"/>
  173. </h5>
  174. <h5>Dia
  175. <xsl:value-of select="dia"/>
  176. </h5>
  177. </tr>
  178. </xsl:template>
  179.  
  180.  
  181. <xsl:template match="ocurrencias">
  182. <h5>Ocurencias Total
  183. <xsl:value-of select="ocurrenciasTotal"/>
  184. </h5>
  185. <h5>Ocurencias Penultimo Ano
  186. <xsl:value-of select="ocurrenciasPenultimoAno"/>
  187. </h5>
  188. <h5>Ocurencias Ultimo Ano
  189. <xsl:value-of select="ocurrenciasUltimoAno"/>
  190. </h5>
  191. </xsl:template>
  192.  
  193. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement