<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:if test="//AssemblyComparison">
<xsl:variable name="assemblyGroup" select="//AssemblyComparison/Groups/Group" />
<xsl:variable name="totalAssemblies" select="count($assemblyGroup)" />
<!-- Header table -->
<table width="100%">
<tr>
<td style="padding-left: 5px; border-top: solid 2px #649cc0;" colspan="2">
<span style="font-size: 14pt">BitDiffer Report</span>
</td>
</tr>
<tr>
<td style="padding-left: 5px;" width="75">
<span style="font-weight: bold;">Options:</span>
</td>
<td style="padding-left: 5px; text-align: left;">
<!-- Hardcoded; change this for your specific BitDiffer options -->
Public only, no implementation
</td>
</tr>
<tr>
<td style="padding-left: 5px;" width="75">
<span style="font-weight: bold;">Assemblies:</span>
</td>
<td style="padding-left: 5px; text-align: left;">
<xsl:value-of select="$totalAssemblies" />
</td>
</tr>
</table>
<!-- Begin building tables for each assembly -->
<xsl:for-each select="$assemblyGroup">
<!--
For each assembly group there are two assemblies: the previous one (where nothing
changed) and the current one. We only care about the current one, so we get that
by querying for the assembly whose WhatChanged attribute equals 'Members'.
-->
<xsl:variable name="changedAssembly" select="Assemblies/Assembly[@WhatChanged = 'Members']" />
<xsl:variable name="namespace" select="$changedAssembly/Namespace" />
<br />
<table style="width: 100%; border: 1px solid #649cc0;" cellpadding="0" cellspacing="0">
<tr>
<td>
<div style="font-size: 10pt; font-weight: bold; padding: 5px 0px 5px 3px; border-bottom: 1px solid #649cc0; background-color: #a9d9f7;">
<xsl:value-of select="@Name" />
</div>
</td>
</tr>
<xsl:choose>
<!-- Check if a changed assembly was found -->
<xsl:when test="$changedAssembly">
<xsl:choose>
<!-- Check for any namespaces in the changed assembly -->
<xsl:when test="$namespace">
<xsl:for-each select="$namespace">
<xsl:choose>
<xsl:when test="@WhatChanged = 'Added'">
<tr>
<td>
<div style="padding: 5px 0px 5px 3px; border-bottom: 1px solid #c1c1c1;">
Added namespace <xsl:value-of select="@Current" />
</div>
</td>
</tr>
</xsl:when>
<xsl:when test="@WhatChanged = 'Removed'">
<tr>
<td>
<div style="padding: 5px 0px 5px 3px; border-bottom: 1px solid #c1c1c1;">
Removed namespace <xsl:value-of select="@Current" />
</div>
</td>
</tr>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="node()">
<tr>
<td>
<div style="font-weight: bold; padding: 3px 0px 3px 3px; border-bottom: 1px solid #c1c1c1; background-color: #dddddd;">
<xsl:value-of select="concat(../@Name, '.', @Name)" />
</div>
</td>
</tr>
<xsl:choose>
<xsl:when test="@WhatChanged = 'Added'">
<tr>
<td>
<div style="padding: 5px 0px 5px 3px; border-bottom: 1px solid #c1c1c1;">
New; did not exist in previous build.
</div>
</td>
</tr>
</xsl:when>
<xsl:when test="@WhatChanged = 'Removed'">
<tr>
<td>
<div style="padding: 5px 0px 5px 3px; border-bottom: 1px solid #c1c1c1;">
Removed.
</div>
</td>
</tr>
</xsl:when>
<xsl:otherwise>
<tr>
<td>
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tr>
<td>
 
</td>
<td>
 
</td>
<td>
<span style="font-weight: bold;">Previous (top)</span>
</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #c1c1c1;">
<span style="font-weight: bold;">Member</span>
</td>
<td style="border-bottom: 1px solid #c1c1c1;">
<span style="font-weight: bold;">What Changed</span>
</td>
<td style="border-bottom: 1px solid #c1c1c1;">
<span style="font-weight: bold;">Current (bottom)</span>
</td>
</tr>
<xsl:for-each select="node()">
<tr>
<td>
 
</td>
<td>
 
</td>
<td>
<xsl:choose>
<xsl:when test="@WhatChanged = 'Added'">
N/A
</xsl:when>
<xsl:when test="@WhatChanged = 'Removed'">
 
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@Previous" />
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #c1c1c1;">
(<xsl:value-of select="name()" />) <xsl:value-of select="@Name" />
</td>
<td style="border-bottom: 1px solid #c1c1c1; width: 110px;">
<xsl:value-of select="@WhatChanged" />
</td>
<td style="border-bottom: 1px solid #c1c1c1;">
<xsl:choose>
<!-- Properties require more logic than other members -->
<xsl:when test="name() = 'Property'">
<xsl:if test="@WhatChanged = 'Declaration'">
<xsl:choose>
<xsl:when test="Method">
<xsl:variable name="propertyMethod" select="Method/@Name" />
<xsl:variable name="propertyWhatChanged" select="Method/@WhatChanged" />
<xsl:if test="$propertyMethod = 'get'">
<xsl:if test="$propertyWhatChanged = 'Added'">
Getter was added.
</xsl:if>
<xsl:if test="$propertyWhatChanged = 'Removed'">
Getter was removed.
</xsl:if>
</xsl:if>
<xsl:if test="$propertyMethod = 'set'">
<xsl:if test="$propertyWhatChanged = 'Added'">
Setter was added.
</xsl:if>
<xsl:if test="$propertyWhatChanged = 'Removed'">
Setter was removed.
</xsl:if>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@Current" />
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="@WhatChanged = 'Added'">
<xsl:value-of select="@Current" />
</xsl:if>
<xsl:if test="@WhatChanged = 'Removed'">
 
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@WhatChanged = 'Added'">
<xsl:value-of select="@Current" />
</xsl:when>
<xsl:when test="@WhatChanged = 'Removed'">
 
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@Current" />
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:for-each>
</table>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>
<!-- This is if there are no namespaces listed in the changed assembly -->
<xsl:otherwise>
<tr>
<td>
<div style="padding: 5px 0px 5px 3px;">
No changes from previous build.
</div>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- This is if a changed assembly was not found -->
<xsl:otherwise>
<tr>
<td>
<div style="padding: 5px 0px 5px 3px;">
No changes from previous build.
</div>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</table>
<br />
</xsl:for-each>
</xsl:if>
</xsl:template>
</xsl:stylesheet>