convert.xsl 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  3. <xsl:output method="html" indent="yes"/>
  4. <!-- Variable -->
  5. <xsl:variable name="title" select="/extract/name" />
  6. <xsl:variable name="nbArticle" select="count(/extract/article)" />
  7. <xsl:variable name="nbInpro" select="count(/extract/inproceedings)" />
  8. <xsl:variable name="nbTotal" select="$nbArticle + $nbInpro" />
  9. <xsl:variable name="nbCoauthor" select="count(/extract/coauthors/author)" />
  10. <!-- Rendu Html -->
  11. <!-- <!DOCTYPE html> -->
  12. <!--<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> -->
  13. <xsl:template match="/extract">
  14. <head>
  15. <meta charset="UTF-8"/>
  16. <title>
  17. <xsl:value-of select="$title" />
  18. </title>
  19. </head>
  20. <body>
  21. <h1>
  22. <xsl:value-of select="$title" />
  23. </h1>
  24. <!--Les Coauteurs -->
  25. <h2>Coauteurs</h2>
  26. <div>
  27. <p>
  28. <xsl:value-of select="$title" />
  29. a écrit avec
  30. <xsl:value-of select="$nbCoauthor"/> auteur<xsl:if test="$nbCoauthor &gt; 1">s</xsl:if> :
  31. </p>
  32. <!-- recupération des coauteurs -->
  33. <ul>
  34. <xsl:for-each select="coauthors/author">
  35. <xsl:sort select="." data-type="text" />
  36. <li>
  37. <xsl:value-of select="." />
  38. </li>
  39. </xsl:for-each>
  40. </ul>
  41. </div>
  42. <!--Les Articles -->
  43. <h2>Articles</h2>
  44. <div>
  45. <p>
  46. <xsl:value-of select="$title" />
  47. a écrit
  48. <xsl:value-of select="count(article)" />
  49. article<xsl:if test="$nbArticle &gt; 1">s</xsl:if> :
  50. </p>
  51. <ul>
  52. <xsl:for-each select="article">
  53. <xsl:sort select="year" data-type="text" />
  54. <li>
  55. Article "<xsl:value-of select="title" />", publié en <xsl:value-of select="year" />, auteur<xsl:if test="count(author) &gt; 1">s</xsl:if> :
  56. <ul>
  57. <xsl:for-each select="author">
  58. <li>
  59. <xsl:value-of select="." />
  60. </li>
  61. </xsl:for-each>
  62. </ul>
  63. </li>
  64. </xsl:for-each>
  65. </ul>
  66. </div>
  67. <!--Les InProceedings-->
  68. <h2>InProceeding</h2>
  69. <div>
  70. <xsl:choose>
  71. <xsl:when test="$nbInpro &gt; 0">
  72. <p>
  73. <xsl:value-of select="$title" />
  74. a écrit
  75. <xsl:value-of select="$nbInpro" />
  76. article<xsl:if test="$nbInpro &gt; 1">s</xsl:if> de type inproceeding :
  77. </p>
  78. <ul>
  79. <xsl:for-each select="inproceedings">
  80. <xsl:sort select="year" data-type="text" />
  81. <li>
  82. InProceeding article "<xsl:value-of select="title" />", publié en <xsl:value-of select="year" />, auteur<xsl:if test="count(author) &gt; 1">s</xsl:if> :
  83. <ul>
  84. <xsl:for-each select="author">
  85. <li>
  86. <xsl:value-of select="." />
  87. </li>
  88. </xsl:for-each>
  89. </ul>
  90. </li>
  91. </xsl:for-each>
  92. </ul>
  93. </xsl:when>
  94. <xsl:otherwise>
  95. <p><xsl:value-of select="$title" /> n'a pas d'article de type inproceedings.</p>
  96. </xsl:otherwise>
  97. </xsl:choose>
  98. </div>
  99. <!-- Statistique -->
  100. <h3>Statistiques sur les articles</h3>
  101. <ul>
  102. <li>Il y a <xsl:value-of select="$nbArticle" /> article<xsl:if test="$nbArticle &gt; 1">s</xsl:if>.</li>
  103. <li>Il y a <xsl:value-of select="$nbInpro" /> article<xsl:if test="$nbInpro &gt; 1">s</xsl:if> de type Inprocessing.</li>
  104. <li>Il y a <xsl:value-of select="$nbTotal" /> article<xsl:if test="$nbTotal &gt; 1">s</xsl:if> de tous les types.</li>
  105. <xsl:for-each select="article">
  106. <xsl:sort select="year"/>
  107. <li>En <xsl:value-of select="year" />, il y a eu <xsl:value-of select="count(../article[year = year])" /> article.</li>
  108. </xsl:for-each>
  109. <xsl:for-each select="inproceedings">
  110. <xsl:sort select="year"/>
  111. <li>En <xsl:value-of select="year" />, il y a eu <xsl:value-of select="count(../inproceedings[year = ./year])" /> article.</li>
  112. </xsl:for-each>
  113. </ul>
  114. </body>
  115. </xsl:template>
  116. <!--</html>-->
  117. </xsl:stylesheet>