/e_desk/_UpgradeReport_Files/UpgradeReport.xslt
Extensible Stylesheet Language Transformations | 232 lines | 204 code | 28 blank | 0 comment | 0 complexity | bb9e5c2013f65a49abb89c6d203f40c8 MD5 | raw file
1<?xml version="1.0" encoding="UTF-8" ?> 2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl='urn:schemas-microsoft-com:xslt'> 3 4 <xsl:key name="ProjectKey" match="Event" use="@Project" /> 5 6 <xsl:template match="Events" mode="createProjects"> 7 <projects> 8 <xsl:for-each select="Event"> 9 <!--xsl:sort select="@Project" order="descending"/--> 10 <xsl:if test="(1=position()) or (preceding-sibling::*[1]/@Project != @Project)"> 11 12 <xsl:variable name="ProjectName" select="@Project"/> 13 14 <project> 15 <xsl:attribute name="name"> 16 <xsl:value-of select="@Project"/> 17 </xsl:attribute> 18 19 <xsl:if test="@Project=''"> 20 <xsl:attribute name="solution"> 21 <xsl:value-of select="@Solution"/> 22 </xsl:attribute> 23 </xsl:if> 24 25 <xsl:for-each select="key('ProjectKey', $ProjectName)"> 26 <!--xsl:sort select="@Source" /--> 27 <xsl:if test="(1=position()) or (preceding-sibling::*[1]/@Source != @Source)"> 28 29 <source> 30 <xsl:attribute name="name"> 31 <xsl:value-of select="@Source"/> 32 </xsl:attribute> 33 34 <xsl:variable name="Source"> 35 <xsl:value-of select="@Source"/> 36 </xsl:variable> 37 38 <xsl:for-each select="key('ProjectKey', $ProjectName)[ @Source = $Source ]"> 39 40 <event> 41 <xsl:attribute name="error-level"> 42 <xsl:value-of select="@ErrorLevel"/> 43 </xsl:attribute> 44 <xsl:attribute name="description"> 45 <xsl:value-of select="@Description"/> 46 </xsl:attribute> 47 </event> 48 </xsl:for-each> 49 </source> 50 </xsl:if> 51 </xsl:for-each> 52 53 </project> 54 </xsl:if> 55 </xsl:for-each> 56 </projects> 57 </xsl:template> 58 59 <xsl:template match="projects"> 60 <xsl:for-each select="project"> 61 <xsl:sort select="@Name" order="ascending"/> 62 <h2> 63 <xsl:if test="@solution">Solution: <xsl:value-of select="@solution"/></xsl:if> 64 <xsl:if test="not(@solution)">Project: <xsl:value-of select="@name"/> 65 <xsl:for-each select="source"> 66 <xsl:variable name="Hyperlink" select="@name"/> 67 <xsl:for-each select="event[@error-level='4']"> 68  <A class="note"><xsl:attribute name="HREF"><xsl:value-of select="$Hyperlink"/></xsl:attribute><xsl:value-of select="@description"/></A> 69 </xsl:for-each> 70 </xsl:for-each> 71 </xsl:if> 72 </h2> 73 74 <table cellpadding="2" cellspacing="0" width="98%" border="1" bordercolor="white" class="infotable"> 75 <tr> 76 <td nowrap="1" class="header" _locID="Filename">Filename</td> 77 <td nowrap="1" class="header" _locID="Status">Status</td> 78 <td nowrap="1" class="header" _locID="Errors">Errors</td> 79 <td nowrap="1" class="header" _locID="Warnings">Warnings</td> 80 </tr> 81 82 <xsl:for-each select="source"> 83 <xsl:sort select="@name" order="ascending"/> 84 <xsl:variable name="source-id" select="generate-id(.)"/> 85 86 <xsl:if test="count(event)!=count(event[@error-level='4'])"> 87 88 <tr class="row"> 89 <td class="content"> 90 <A HREF="javascript:"><xsl:attribute name="onClick">javascript:document.images['<xsl:value-of select="$source-id"/>'].click()</xsl:attribute><IMG border="0" alt="expand/collapse section" class="expandable" height="11" onclick="changepic()" src="_UpgradeReport_Files/UpgradeReport_Plus.gif" width="9" ><xsl:attribute name="name"><xsl:value-of select="$source-id"/></xsl:attribute><xsl:attribute name="child">src<xsl:value-of select="$source-id"/></xsl:attribute></IMG></A> <xsl:value-of select="@name"/> 91 </td> 92 <td class="content"> 93 <xsl:if test="count(event[@error-level='3'])=1"> 94 <xsl:for-each select="event[@error-level='3']"> 95 <xsl:if test="@description='Converted'">Converted</xsl:if> 96 <xsl:if test="@description!='Converted'"><xsl:value-of select="@description"/></xsl:if> 97 </xsl:for-each> 98 </xsl:if> 99 <xsl:if test="count(event[@error-level='3'])!=1 and count(event[@error-level='3' and @description='Converted'])!=0">Converted 100 </xsl:if> 101 </td> 102 <td class="content"><xsl:value-of select="count(event[@error-level='2'])"/></td> 103 <td class="content"><xsl:value-of select="count(event[@error-level='1'])"/></td> 104 </tr> 105 106 <tr class="collapsed" bgcolor="#ffffff"> 107 <xsl:attribute name="id">src<xsl:value-of select="$source-id"/></xsl:attribute> 108 109 <td colspan="7"> 110 <table width="97%" border="1" bordercolor="#dcdcdc" rules="cols" class="issuetable"> 111 <tr> 112 <td colspan="7" class="issuetitle" _locID="ConversionIssues">Conversion Issues - <xsl:value-of select="@name"/>:</td> 113 </tr> 114 115 <xsl:for-each select="event[@error-level!='3']"> 116 <xsl:if test="@error-level!='4'"> 117 <tr> 118 <td class="issuenone" style="border-bottom:solid 1 lightgray"> 119 <xsl:value-of select="@description"/> 120 </td> 121 </tr> 122 </xsl:if> 123 </xsl:for-each> 124 </table> 125 </td> 126 </tr> 127 </xsl:if> 128 </xsl:for-each> 129 130 <tr valign="top"> 131 <td class="foot"> 132 <xsl:if test="count(source)!=1"> 133 <xsl:value-of select="count(source)"/> files 134 </xsl:if> 135 <xsl:if test="count(source)=1"> 136 1 file 137 </xsl:if> 138 </td> 139 <td class="foot"> 140 Converted: <xsl:value-of select="count(source/event[@error-level='3' and @description='Converted'])"/><BR /> 141 Not converted <xsl:value-of select="count(source) - count(source/event[@error-level='3' and @description='Converted'])"/> 142 </td> 143 <td class="foot"><xsl:value-of select="count(source/event[@error-level='2'])"/></td> 144 <td class="foot"><xsl:value-of select="count(source/event[@error-level='1'])"/></td> 145 </tr> 146 </table> 147 </xsl:for-each> 148 </xsl:template> 149 150 <xsl:template match="Property"> 151 <xsl:if test="@Name!='Date' and @Name!='Time' and @Name!='LogNumber' and @Name!='Solution'"> 152 <tr><td nowrap="1"><b><xsl:value-of select="@Name"/>: </b><xsl:value-of select="@Value"/></td></tr> 153 </xsl:if> 154 </xsl:template> 155 156 <xsl:template match="UpgradeLog"> 157 <html> 158 <head> 159 <META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8" /> 160 <link rel="stylesheet" href="_UpgradeReport_Files\UpgradeReport.css" /> 161 <title>Conversion Report  162 <xsl:if test="Properties/Property[@Name='LogNumber']"> 163 <xsl:value-of select="Properties/Property[@Name='LogNumber']/@Value"/> 164 </xsl:if> 165 </title> 166 <script language="javascript"> 167 function outliner () { 168 oMe = window.event.srcElement 169 //get child element 170 var child = document.all[event.srcElement.getAttribute("child",false)]; 171 //if child element exists, expand or collapse it. 172 if (null != child) 173 child.className = child.className == "collapsed" ? "expanded" : "collapsed"; 174 } 175 176 function changepic() { 177 uMe = window.event.srcElement; 178 var check = uMe.src.toLowerCase(); 179 if (check.lastIndexOf("upgradereport_plus.gif") != -1) 180 { 181 uMe.src = "_UpgradeReport_Files/UpgradeReport_Minus.gif" 182 } 183 else 184 { 185 uMe.src = "_UpgradeReport_Files/UpgradeReport_Plus.gif" 186 } 187 } 188 </script> 189 </head> 190 <body topmargin="0" leftmargin="0" rightmargin="0" onclick="outliner();"> 191 <h1 _locID="ConversionReport">Conversion Report - <xsl:value-of select="Properties/Property[@Name='Solution']/@Value"/></h1> 192 193 <p><span class="note"> 194 <b>Time of Conversion:</b>  <xsl:value-of select="Properties/Property[@Name='Date']/@Value"/>  <xsl:value-of select="Properties/Property[@Name='Time']/@Value"/><br/> 195 </span></p> 196 197 <xsl:variable name="SortedEvents"> 198 <Events> 199 <xsl:for-each select="Event"> 200 <xsl:sort select="@Project" order="ascending"/> 201 <xsl:sort select="@Source" order="ascending"/> 202 <xsl:sort select="@ErrorLevel" order="ascending"/> 203 <Event> 204 <xsl:attribute name="Project"><xsl:value-of select="@Project"/> </xsl:attribute> 205 <xsl:attribute name="Solution"><xsl:value-of select="/UpgradeLog/Properties/Property[@Name='Solution']/@Value"/> </xsl:attribute> 206 <xsl:attribute name="Source"><xsl:value-of select="@Source"/> </xsl:attribute> 207 <xsl:attribute name="ErrorLevel"><xsl:value-of select="@ErrorLevel"/> </xsl:attribute> 208 <xsl:attribute name="Description"><xsl:value-of select="@Description"/> </xsl:attribute> 209 </Event> 210 </xsl:for-each> 211 </Events> 212 </xsl:variable> 213 214 <xsl:variable name="Projects"> 215 <xsl:apply-templates select="msxsl:node-set($SortedEvents)/*" mode="createProjects"/> 216 </xsl:variable> 217 218 <xsl:apply-templates select="msxsl:node-set($Projects)/*"/> 219 220 <p></p><p> 221 <table class="note"> 222 <tr> 223 <td nowrap="1"> 224 <b>Conversion Settings</b> 225 </td> 226 </tr> 227 <xsl:apply-templates select="Properties"/> 228 </table></p> 229 </body> 230 </html> 231 </xsl:template> 232</xsl:stylesheet>