Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 KB | None | 0 0
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  3.  
  4. <xsl:template match="/">
  5. <html>
  6. <head>
  7. <title>Ranking języków</title>
  8. <link rel="stylesheet" href="./style/styl1.css"/>
  9. </head>
  10.  
  11. <body>
  12. <xsl:choose>
  13. <xsl:when test="$tytul = 'Popularność języków programowania' ">
  14. <h1><xsl:value-of select="$tytul"/></h1>
  15. <xsl:call-template name="wszystkieJezyki"/>
  16. <h2>Popularność języków wśród użytkowników stackoverflow 2019r.</h2>
  17. <xsl:call-template name="sortuj"/>
  18. </xsl:when>
  19. <xsl:otherwise>
  20. <xsl:apply-templates select="programowanie/SI"/>
  21. </xsl:otherwise>
  22. </xsl:choose>
  23. </body>
  24. </html>
  25. </xsl:template>
  26. <xsl:template name="wszystkieJezyki">
  27. <div class="unlista">
  28. <xsl:text>Języki webowe:</xsl:text>
  29. <br/>
  30. <xsl:for-each select="programowanie/*/jezyk">
  31. <xsl:number value="position()" format="1" />
  32. <xsl:text> </xsl:text>
  33. <xsl:value-of select="@nazwa" />
  34. <br/>
  35. <xsl:call-template name="opisy"/>
  36. <br/>
  37. </xsl:for-each>
  38. </div>
  39. </xsl:template>
  40.  
  41. <xsl:template name="opisy">
  42. <xsl:if test="pelnaNazwa != @nazwa">
  43. <xsl:text>Pełna nazwa: </xsl:text><xsl:value-of select="pelnaNazwa"/><br/>
  44. </xsl:if>
  45. <xsl:value-of select="opis"/><br/>
  46. <xsl:choose>
  47. <xsl:when test="framework">
  48. <xsl:call-template name="frameworki"/>
  49. </xsl:when>
  50. <xsl:when test="preprocesor">
  51. <br/><xsl:text>Preprocesor: </xsl:text>
  52. <xsl:apply-templates select="preprocesor"/>
  53. </xsl:when>
  54. </xsl:choose>
  55. </xsl:template>
  56.  
  57. <xsl:template match="preprocesor">
  58. <xsl:value-of select="nazwa"/><br/>
  59. <xsl:value-of select="opis"/><br/><br/>
  60. </xsl:template>
  61.  
  62. <xsl:template name="frameworki">
  63. <br/><xsl:text>Framework: </xsl:text>
  64. <xsl:value-of select="framework/nazwa"/><br/>
  65. <xsl:value-of select="framework/opis"/><br/>
  66. </xsl:template>
  67.  
  68. <xsl:template name="sortuj">
  69. <xsl:for-each select="programowanie/*/jezyk">
  70. <xsl:sort select="popularnosc" data-type="number" order="descending" />
  71. <xsl:number value="position()" format="1" />
  72. <xsl:value-of select="@nazwa" /><br />
  73.  
  74. </xsl:for-each>
  75.  
  76. </xsl:template>
  77.  
  78. <xsl:template match="programowanie/SI">
  79. <h2>HISTORIA</h2>
  80. <xsl:apply-templates select="pierwszeJezyki/jezyk"/><br/>
  81. <h2>Modele uczenia maszynowego</h2>
  82. <xsl:apply-templates select="uczenieMaszynowe"/><br/>
  83. </xsl:template>
  84.  
  85. <xsl:template match="pierwszeJezyki/jezyk">
  86. <xsl:apply-templates select="@nazwa"/>
  87. <xsl:apply-templates select="opis"/>
  88. </xsl:template>
  89.  
  90. <xsl:template match="@nazwa">
  91. <xsl:value-of select="."/><br/>
  92. </xsl:template>
  93.  
  94. <xsl:template match="opis">
  95. <xsl:value-of select="."/><br/>
  96. </xsl:template>
  97.  
  98. <xsl:template match="uczenieMaszynowe">
  99. <xsl:apply-templates select="model"/>
  100. </xsl:template>
  101.  
  102. <xsl:template match="model">
  103. <xsl:value-of select="typ"/><br/>
  104. <xsl:value-of select="algorytmy"/><br/>
  105. </xsl:template>
  106.  
  107. <xsl:variable name="tytul"><xsl:text>Sztuczna Inteligencja</xsl:text></xsl:variable>
  108. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement