MassDataHandlerLogFile.xsl 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  3. <xsl:output method="html"/>
  4. <!-- global values from root element attributes (LogFile): -->
  5. <xsl:variable name="DateText" select="/LogFile/@dateText"/>
  6. <xsl:variable name="DateTime" select="/LogFile/@dateTime"/>
  7. <xsl:variable name="TypeColHeader" select="/LogFile/@typeText"/>
  8. <xsl:variable name="MessageColHeader" select="/LogFile/@messageText"/>
  9. <xsl:variable name="HelpIdColHeader" select="/LogFile/@helpIdText"/>
  10. <xsl:variable name="TimeColHeader" select="/LogFile/@timeText"/>
  11. <xsl:variable name="ProjectName" select="/LogFile/@projectName"/>
  12. <xsl:variable name="PageTitle" select="/LogFile/@titleName"/>
  13. <!-- /global values from root element attributes -->
  14. <xsl:variable name="SupportedMessageTypes">|Action|CriticalError|CriticalDecision|CriticalErrorDecision|Decision|Error|ErrorDecision|Information|Input|Success|Warning|</xsl:variable>
  15. <xsl:variable name="IconFileExtension">jpg</xsl:variable>
  16. <xsl:variable name="Action">ICO_PE_InfoActionRequest.ico</xsl:variable>
  17. <xsl:variable name="CriticalError">ICO_PE_InfoErrorCritical.ico</xsl:variable>
  18. <xsl:variable name="CriticalDecision">ICO_PE_InfoDecisionCritical.ico</xsl:variable>
  19. <xsl:variable name="CriticalErrorDecision">ICO_PE_InfoErrorCritical.ico</xsl:variable>
  20. <xsl:variable name="Decision">ICO_PE_InfoDecision.ico</xsl:variable>
  21. <xsl:variable name="Error">ICO_PE_InfoError.ico</xsl:variable>
  22. <xsl:variable name="ErrorDecision">ICO_PE_InfoError.ico</xsl:variable>
  23. <xsl:variable name="Information">ICO_PE_InfoInformation.ico</xsl:variable>
  24. <xsl:variable name="Input">ICO_PE_InfoInputRequired.ico</xsl:variable>
  25. <xsl:variable name="Success">ICO_PE_InfoSuccess.ico</xsl:variable>
  26. <xsl:variable name="Warning">ICO_PE_InfoWarning.ico</xsl:variable>
  27. <xsl:template match="/LogFile">
  28. <html>
  29. <head>
  30. <title><xsl:value-of select="$PageTitle"/></title>
  31. <style type="text/css">
  32. .TitleText { font-family:'Siemens TIA Portal Basic'; font-size:15pt; font-weight: bold; color: #59717d; line-height:23px; }
  33. .Text { font-family:'Siemens TIA Portal Basic'; font-size:10pt; font-weight: bold; color: black; line-height:26px; }
  34. .TableHeader { font-family:'Siemens TIA Portal Basic'; font-size:10pt; font-weight: bold; height: 15pt; text-indent: 5pt; border-style: solid; border-color: #8ca3b0; border-width: 0.5pt 0.5pt 0.5pt 0.0pt; background-color:#b6c5cf; }
  35. .TableHeader1 { font-family:'Siemens TIA Portal Basic'; font-size:10pt; font-weight: bold; height: 15pt; text-indent: 5pt; border-style: solid; border-color: #bfbfbf; border-width: 0.0pt 0.5pt 0.5pt 0.0pt; background-color:#d4dbde; }
  36. .TableHeader2 { font-family:'Siemens TIA Portal Basic'; font-size:10pt; font-weight: bold; height: 15pt; text-indent: 5pt; border-style: solid; border-color: #bfbfbf; border-width: 0.0pt 0.5pt 0.5pt 0.0pt; background-color:#e7ebed; }
  37. .TableContent { font-family:'Siemens TIA Portal Basic'; font-size:10pt; font-weight: normal; height: 15pt; text-indent: 5pt; border-style: solid; border-color: #bfbfbf; border-width: 0.0pt 0.5pt 0.5pt 0.0pt; }
  38. </style>
  39. </head>
  40. <body>
  41. <p class="TitleText">
  42. <xsl:value-of select="$ProjectName"/>
  43. </p>
  44. <span class="Text">
  45. <xsl:value-of select="$DateText"/>
  46. &#160;
  47. <xsl:value-of select="$DateTime"/>
  48. </span>
  49. <table cellspacing="0" cellpadding="3" style="border-left: 1px solid #bfbfbf">
  50. <tr class="TableHeader">
  51. <td class="TableHeader" align="left" style="width: 32px; text-indent: 0;">
  52. <xsl:value-of select="$TypeColHeader"/>
  53. </td>
  54. <td class="TableHeader" align="left" style="width: 648px">
  55. <xsl:value-of select="$MessageColHeader"/>
  56. </td>
  57. <td class="TableHeader" align="left" style="width: 90px">
  58. <xsl:value-of select="$TimeColHeader"/>
  59. </td>
  60. </tr>
  61. <xsl:apply-templates select="LogEntry"/>
  62. </table>
  63. </body>
  64. </html>
  65. </xsl:template>
  66. <xsl:template name="LogEntry" match="LogFile/LogEntry">
  67. <xsl:param name="Level" select="1"/>
  68. <xsl:choose>
  69. <!-- when element has a child element named 'LogEntry' -->
  70. <xsl:when test="LogEntry">
  71. <!-- call branch template on entry -->
  72. <xsl:call-template name="LogEntryBranch">
  73. <xsl:with-param name="Level" select="$Level"/>
  74. </xsl:call-template>
  75. <!-- recurse on children -->
  76. <xsl:for-each select="LogEntry">
  77. <xsl:call-template name="LogEntry">
  78. <xsl:with-param name="Level" select="$Level+1"/>
  79. </xsl:call-template>
  80. </xsl:for-each>
  81. </xsl:when>
  82. <xsl:otherwise>
  83. <!-- entry has no children, apply leaf style -->
  84. <xsl:call-template name="LogEntryLeaf">
  85. <xsl:with-param name="Level" select="$Level"/>
  86. </xsl:call-template>
  87. </xsl:otherwise>
  88. </xsl:choose>
  89. </xsl:template>
  90. <xsl:template name="LogEntryBranch">
  91. <xsl:param name="Level" select="1"/>
  92. <xsl:variable name="class" select="concat('TableHeader', $Level)"/>
  93. <tr class="{$class}">
  94. <td class="{$class}">&#160;</td>
  95. <td class="{$class}">
  96. <xsl:value-of select="Message"/>
  97. <!-- IE6 doesn't support empty-cells style so insert a non-breaking space where needed-->
  98. <xsl:if test="normalize-space(Message)=false()">&#160;</xsl:if>
  99. </td>
  100. <td class="{$class}">
  101. <xsl:value-of select="@dateTime"/>
  102. <!-- IE6 doesn't support empty-cells style so insert a non-breaking space where needed-->
  103. <xsl:if test="normalize-space(@dateTime)=false()">&#160;</xsl:if>
  104. </td>
  105. </tr>
  106. </xsl:template>
  107. <xsl:template name="LogEntryLeaf">
  108. <xsl:param name="Level" select="1"/>
  109. <tr class="TableContent">
  110. <td align="center" class="TableContent" style="text-indent:0;">
  111. <xsl:choose>
  112. <xsl:when test="contains($SupportedMessageTypes, concat('|', @type,'|') )">
  113. <xsl:element name="img">
  114. <xsl:attribute name="src">
  115. <xsl:choose>
  116. <xsl:when test="@type = 'Action'">ICO_PE_InfoActionRequest.ico</xsl:when>
  117. <xsl:when test="@type = 'CriticalError'">ICO_PE_InfoErrorCritical.ico</xsl:when>
  118. <xsl:when test="@type = 'CriticalDecision'">ICO_PE_InfoDecisionCritical.ico</xsl:when>
  119. <xsl:when test="@type = 'CriticalErrorDecision'">ICO_PE_InfoErrorCritical.ico</xsl:when>
  120. <xsl:when test="@type = 'Decision'">ICO_PE_InfoDecision.ico</xsl:when>
  121. <xsl:when test="@type = 'Error'">ICO_PE_InfoError.ico</xsl:when>
  122. <xsl:when test="@type = 'ErrorDecision'">ICO_PE_InfoError.ico</xsl:when>
  123. <xsl:when test="@type = 'Information'">ICO_PE_InfoInformation.ico</xsl:when>
  124. <xsl:when test="@type = 'Input'">ICO_PE_InfoInputRequired.ico</xsl:when>
  125. <xsl:when test="@type = 'Success'">ICO_PE_InfoSuccess.ico</xsl:when>
  126. <xsl:when test="@type = 'Warning'">ICO_PE_InfoWarning.ico</xsl:when>
  127. </xsl:choose>
  128. </xsl:attribute>
  129. <xsl:attribute name="height">16</xsl:attribute>
  130. <xsl:attribute name="width">16</xsl:attribute>
  131. </xsl:element>
  132. </xsl:when>
  133. <!-- IE6 doesn't support empty-cells style so insert a non-breaking space where needed-->
  134. <xsl:otherwise>&#160;</xsl:otherwise>
  135. </xsl:choose>
  136. </td>
  137. <td align="left" class="TableContent">
  138. <xsl:value-of select="Message"/>
  139. <!-- IE6 doesn't support empty-cells style so insert a non-breaking space where needed-->
  140. <xsl:if test="normalize-space(Message)=false()">&#160;</xsl:if>
  141. </td>
  142. <td align="left" class="TableContent">
  143. <xsl:value-of select="@dateTime"/>
  144. <!-- IE6 doesn't support empty-cells style so insert a non-breaking space where needed-->
  145. <xsl:if test="normalize-space(@dateTime)=false()">&#160;</xsl:if>
  146. </td>
  147. </tr>
  148. </xsl:template>
  149. </xsl:stylesheet>