Advertisement
Guest User

xsl for metrics by Frank Sauer

a guest
Jan 2nd, 2013
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.74 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. xsl by Frank Sauer
  4. from http://sourceforge.net/forum/message.php?msg_id=2041225
  5. -->
  6. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://metrics.sourceforge.net/2003/Metrics-First-Flat">
  7. <xsl:output omit-xml-declaration="yes" media-type="text/html" indent="yes" method="html"/>
  8. <xsl:template match="/m:Metrics">
  9. <html>
  10. <head>
  11. <title>Metrics Report for <xsl:value-of select="@type"/> <xsl:value-of select="@scope"/></title>
  12. </head>
  13. <body>
  14. <h1>Metrics Report for <xsl:value-of select="@scope"/> (<xsl:value-of select="@type"/>)</h1>
  15. <xsl:apply-templates/>
  16. </body>
  17. </html>
  18. </xsl:template>
  19.  
  20. <xsl:template match="m:Metric">
  21. <h2><xsl:value-of select="@description"/> (<xsl:value-of select="@id"/>)</h2>
  22. <xsl:apply-templates/>
  23. </xsl:template>
  24.  
  25. <xsl:template match="m:Values">
  26. <p>Average per <xsl:value-of select="@per"/> is <xsl:value-of select="@avg"/></p>
  27. <p>Standard Deviation is <xsl:value-of select="@stddev"/></p>
  28. <p>Maximum value is <xsl:value-of select="@max"/></p>
  29. <table border="1">
  30. <tbody>
  31. <tr>
  32. <th><xsl:value-of select="@per"/></th>
  33. <xsl:if test="m:Value/@source">
  34. <th>file</th>
  35. </xsl:if>
  36. <th>package</th><th>value</th>
  37. </tr>
  38. <xsl:apply-templates mode="multiple"/>
  39. </tbody>
  40. </table>
  41. </xsl:template>
  42.  
  43. <xsl:template match="m:Value" mode="multiple">
  44. <tr>
  45. <td><xsl:value-of select="@name"/></td>
  46. <xsl:if test="@source"><td><xsl:value-of select="@source"/></td></xsl:if>
  47. <td><xsl:value-of select="@package"/></td><td><xsl:value-of select="@value"/></td>
  48. </tr>
  49. </xsl:template>
  50.  
  51. <xsl:template match="m:Value">
  52. <p>Value: <xsl:value-of select="@value"/></p>
  53. </xsl:template>
  54.  
  55. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement