accueil.xslt 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
  4. >
  5. <xsl:output method="xml" indent="yes"/>
  6. <xsl:preserve-space elements="" />
  7. <xsl:template name="nl2br">
  8. <xsl:param name="contents" />
  9. <xsl:choose>
  10. <xsl:when test="contains($contents, '&#10;')">
  11. <xsl:value-of select="substring-before($contents, '&#10;')" disable-output-escaping="yes" />
  12. <br />
  13. <xsl:call-template name="nl2br">
  14. <xsl:with-param name="contents" select="substring-after($contents, '&#10;')" />
  15. </xsl:call-template>
  16. </xsl:when>
  17. <xsl:otherwise>
  18. <xsl:value-of select="$contents" disable-output-escaping="yes" />
  19. </xsl:otherwise>
  20. </xsl:choose>
  21. </xsl:template>
  22. <xsl:template match ="/">
  23. <br/>
  24. <h2>Les derniers ajouts dans la base de connaissances</h2>
  25. <table class="table">
  26. <thead>
  27. <tr class="tr-p">
  28. <th>Thématique</th>
  29. <th>Solution/Problème</th>
  30. </tr>
  31. </thead>
  32. <tbody>
  33. <xsl:apply-templates select ="//doc"></xsl:apply-templates>
  34. </tbody>
  35. </table>
  36. </xsl:template>
  37. <xsl:template match="doc">
  38. <tr>
  39. <xsl:if test="position() mod 2 = 0">
  40. <xsl:attribute name="class">tr-p</xsl:attribute>
  41. </xsl:if>
  42. <!-- class="element-result"-->
  43. <!--<a href="/Applications/DetailApplication?id={str[@name='codeappli']}">-->
  44. <td class="wp-20">
  45. <!--<xsl:value-of select ="str[@name='nomappli']"/></a>-->
  46. <xsl:value-of select="str[@name='idappli']" /> - <xsl:value-of select ="str[@name='nomappli']"/>
  47. </td>
  48. <td class="wp-100">
  49. <!--<a href="/Applications/DetailProbleme?id={str[@name='id']}" title="voir la fiche du probleme">-->
  50. <b>
  51. <xsl:value-of select ="str[@name='probleme']"/>
  52. </b>
  53. <br></br>
  54. <div class="btn toggle">Afficher</div>
  55. <div class="solution">
  56. <xsl:call-template name="nl2br">
  57. <xsl:with-param name="contents" select="str[@name='solution']" />
  58. </xsl:call-template>
  59. <xsl:if test ="count(arr[@name='piecejointe']/str) &gt; 0">
  60. <p>
  61. <b>
  62. <xsl:choose>
  63. <xsl:when test ="count(arr[@name='piecejointe']/str) = 1">
  64. Voir aussi dans la piece jointe suivante
  65. </xsl:when>
  66. <xsl:otherwise>
  67. Voir aussi dans les pieces jointes suivantes
  68. </xsl:otherwise>
  69. </xsl:choose>
  70. </b>
  71. </p>
  72. <ul>
  73. <xsl:for-each select ="arr[@name='piecejointe']/str">
  74. <li>
  75. <a href="{substring-before(.,'||||')}" target="_blank">
  76. <xsl:value-of select ="substring-after(.,'||||')"/>
  77. </a>
  78. </li>
  79. </xsl:for-each>
  80. </ul>
  81. </xsl:if>
  82. </div>
  83. <!--</a>-->
  84. </td>
  85. </tr>
  86. </xsl:template>
  87. </xsl:stylesheet>