mqxliffHistory.xsl 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions"
  3. xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2" xmlns:mq="MQXliff" xml:space="preserve">
  4. <xsl:output method="html" encoding="UTF-8" indent="yes"/>
  5. <xsl:template match="/">
  6. <html>
  7. <head>
  8. <title>History for <xsl:value-of select="//xliff:file/@original" /></title>
  9. <style>
  10. table {
  11. width: 100%;
  12. }
  13. td {
  14. word-wrap: break-word;
  15. overflow: hidden;
  16. }
  17. table, th, td {
  18. border: 1px solid black;
  19. }
  20. caption {
  21. font-weight: bold;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <table>
  27. <caption>Versions</caption>
  28. <tbody>
  29. <tr>
  30. <th>Version</th>
  31. <th>Event</th>
  32. <th>User</th>
  33. </tr>
  34. <xsl:apply-templates select="//mq:versioninfos" />
  35. </tbody>
  36. </table>
  37. <br/>
  38. <table>
  39. <caption>Segments</caption>
  40. <tbody>
  41. <xsl:apply-templates select="//xliff:body" />
  42. </tbody>
  43. </table>
  44. </body>
  45. </html>
  46. </xsl:template>
  47. <xsl:template match="//mq:versioninfos">
  48. <xsl:for-each select="mq:minorversioninfo">
  49. <tr>
  50. <td><xsl:value-of select="./@mq:minorversion" /></td>
  51. <td><xsl:value-of select="./@mq:createreason" /></td>
  52. <td><xsl:value-of select="./@mq:creatoruser" /></td>
  53. </tr>
  54. </xsl:for-each>
  55. </xsl:template>
  56. <xsl:template match="//xliff:body">
  57. <xsl:for-each select="xliff:trans-unit">
  58. <tr>
  59. <th>Segment#</th>
  60. <th>Version</th>
  61. <th>Source</th>
  62. <th>Target</th>
  63. <th>Status</th>
  64. <th>User</th>
  65. <th>Date</th>
  66. </tr>
  67. <tr>
  68. <td><xsl:value-of select="./@id" /></td>
  69. <td><xsl:text>Current</xsl:text></td>
  70. <td><xsl:value-of select="./xliff:source/text()" /></td>
  71. <td><xsl:value-of select="./xliff:target/text()" /></td>
  72. <td><xsl:value-of select="./@mq:status" /></td>
  73. <td><xsl:value-of select="./@mq:lastchanginguser" /></td>
  74. <td><xsl:value-of select="./@mq:lastchangedtimestamp" /></td>
  75. </tr>
  76. <xsl:apply-templates select="mq:minorversions" />
  77. </xsl:for-each>
  78. </xsl:template>
  79. <xsl:template match="mq:minorversions">
  80. <xsl:for-each select="mq:historical-unit">
  81. <tr>
  82. <td></td>
  83. <td><xsl:value-of select="./@mq:minorversionstart" /><xsl:text> - </xsl:text><xsl:value-of select="./@mq:minorversionend" /></td>
  84. <td><xsl:value-of select="./xliff:source/text()" /></td>
  85. <td><xsl:value-of select="./xliff:target/text()" /></td>
  86. <td><xsl:value-of select="./@mq:status" /></td>
  87. <td><xsl:value-of select="./@mq:lastchanginguser" /></td>
  88. <td><xsl:value-of select="./@mq:lastchangedtimestamp" /></td>
  89. </tr>
  90. </xsl:for-each>
  91. </xsl:template>
  92. </xsl:stylesheet>