master
  1<?xml version="1.0" encoding="UTF-8"?>
  2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3                xmlns:g="http://www.gallio.org/">
  4  <xsl:param name="resourceRoot" select="''" />
  5  
  6  <xsl:param name="show-passed-tests">true</xsl:param>
  7  <xsl:param name="show-failed-tests">true</xsl:param>
  8  <xsl:param name="show-inconclusive-tests">true</xsl:param>
  9  <xsl:param name="show-skipped-tests">true</xsl:param>
 10
 11  <xsl:output method="text" encoding="utf-8"/>
 12
 13  <xsl:template match="/">
 14    <xsl:apply-templates select="//g:report" />
 15  </xsl:template>
 16
 17  <xsl:template match="g:report">
 18		<xsl:apply-templates select="." mode="results"/>
 19    <xsl:apply-templates select="g:packageRun/g:statistics" />
 20  </xsl:template>
 21  
 22	<xsl:template match="g:statistics">
 23    <xsl:text>* Results: </xsl:text>
 24    <xsl:call-template name="format-statistics">
 25      <xsl:with-param name="statistics" select="." />
 26    </xsl:call-template>
 27		<xsl:text>&#xA;</xsl:text>
 28	</xsl:template>
 29  
 30	<xsl:template match="g:report" mode="results">
 31    <xsl:variable name="testCases" select="g:packageRun/g:testStepRun/descendant-or-self::g:testStepRun[g:testStep/@isTestCase='true']" />
 32    
 33    <xsl:variable name="passed" select="$testCases[g:result/g:outcome/@status='passed']" />
 34    <xsl:variable name="failed" select="$testCases[g:result/g:outcome/@status='failed']" />
 35    <xsl:variable name="inconclusive" select="$testCases[g:result/g:outcome/@status='inconclusive']" />
 36    <xsl:variable name="skipped" select="$testCases[g:result/g:outcome/@status='skipped']" />
 37
 38    <xsl:if test="$show-passed-tests and $passed">
 39      <xsl:text>* Passed:&#xA;&#xA;</xsl:text>
 40      <xsl:apply-templates select="$passed" />
 41      <xsl:text>&#xA;</xsl:text>
 42    </xsl:if>
 43
 44    <xsl:if test="$show-failed-tests and $failed">
 45      <xsl:text>* Failed:&#xA;&#xA;</xsl:text>
 46      <xsl:apply-templates select="$failed" />
 47      <xsl:text>&#xA;</xsl:text>
 48    </xsl:if>
 49    
 50    <xsl:if test="$show-inconclusive-tests and $inconclusive">
 51      <xsl:text>* Inconclusive:&#xA;&#xA;</xsl:text>
 52      <xsl:apply-templates select="$inconclusive" />
 53      <xsl:text>&#xA;</xsl:text>
 54    </xsl:if>
 55    
 56    <xsl:if test="$show-skipped-tests and $skipped">
 57      <xsl:text>* Skipped:&#xA;&#xA;</xsl:text>
 58      <xsl:apply-templates select="$skipped" />
 59      <xsl:text>&#xA;</xsl:text>
 60    </xsl:if>
 61	</xsl:template>
 62  
 63  <xsl:template match="g:testStepRun">
 64    <xsl:variable name="testId" select="g:testStep/@testId" />
 65    <xsl:variable name="test" select="//g:test[@id=$testId]" />
 66
 67    <xsl:text>[</xsl:text>
 68    <xsl:value-of select="$test/g:metadata/g:entry[@key='TestKind']/g:value" />
 69    <xsl:text>] </xsl:text>
 70    <xsl:value-of select="g:testStep/@fullName" />
 71    <xsl:text>&#xA;</xsl:text>
 72    <xsl:apply-templates select="g:executionLog" />
 73    <xsl:text>&#xA;</xsl:text>
 74
 75    <xsl:apply-templates select="g:children/g:testStepRun" />
 76  </xsl:template>
 77
 78  <xsl:template match="g:executionLog">
 79    <xsl:apply-templates select="g:streams" />
 80  </xsl:template>
 81
 82  <xsl:template match="g:streams">
 83    <xsl:apply-templates select="g:stream" />
 84  </xsl:template>
 85  
 86  <xsl:template match="g:stream">
 87    <xsl:param name="prefix" select="'  '" />
 88
 89    <xsl:value-of select="$prefix"/>
 90    <xsl:text>&lt;Stream: </xsl:text>
 91    <xsl:value-of select="@name" />
 92    <xsl:text>&gt;&#xA;</xsl:text>
 93    <xsl:apply-templates select="g:body">
 94      <xsl:with-param name="prefix" select="concat($prefix, '  ')" />
 95    </xsl:apply-templates>
 96    <xsl:value-of select="$prefix"/>
 97    <xsl:text>&lt;End Stream&gt;&#xA;</xsl:text>
 98  </xsl:template>
 99  
100  <xsl:template match="g:body">
101    <xsl:param name="prefix" select="''" />
102
103    <xsl:apply-templates select="g:contents">
104      <xsl:with-param name="prefix" select="$prefix" />
105    </xsl:apply-templates>
106  </xsl:template>
107
108  <xsl:template match="g:contents">
109    <xsl:param name="prefix" select="''"  />
110    
111    <xsl:apply-templates select="child::node()[self::g:text or self::g:section or self::g:embed]">
112      <xsl:with-param name="prefix" select="$prefix" />
113    </xsl:apply-templates>
114  </xsl:template>
115
116  <xsl:template match="g:text">
117    <xsl:param name="prefix" select="''"  />
118    
119    <xsl:call-template name="indent">
120      <xsl:with-param name="str" select="text()" />
121      <xsl:with-param name="prefix" select="$prefix" />
122    </xsl:call-template>
123  </xsl:template>
124
125  <xsl:template match="g:section">
126    <xsl:param name="prefix" select="''"  />
127    
128    <xsl:value-of select="$prefix"/>
129    <xsl:text>&lt;Section: </xsl:text>
130    <xsl:value-of select="@name" />
131    <xsl:text>&gt;&#xA;</xsl:text>
132    <xsl:apply-templates select="g:contents">
133      <xsl:with-param name="prefix" select="concat($prefix, '  ')" />
134    </xsl:apply-templates>
135    <xsl:value-of select="$prefix"/>
136    <xsl:text>&lt;End Section&gt;&#xA;</xsl:text>
137  </xsl:template>
138
139  <xsl:template match="g:embed">
140    <xsl:param name="prefix" select="''"  />
141    
142    <xsl:value-of select="$prefix"/>
143    <xsl:text>&lt;Attachment: </xsl:text>
144    <xsl:value-of select="@attachmentName"/>
145    <xsl:text>&gt;&#xA;</xsl:text>
146  </xsl:template>
147
148  <xsl:template match="*">
149  </xsl:template>
150  
151  <!-- Include the common report template -->
152  <xsl:include href="Gallio-Report.common.xsl" />  
153</xsl:stylesheet>