mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-23 06:15:04 +00:00
Port to XSLT
This commit is contained in:
1 parent
8fed3395d7
commit
bc75ba14a3
8 files changed
+551
No files matched your search
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsltu="http://xsltunit.org/0/" version="1.0">
|
||||
|
||||
<xsl:param name="testname" />
|
||||
|
||||
<xsl:template match="xsltu:tests">
|
||||
<html>
|
||||
<head>
|
||||
<title>All Tests</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Tests Stylesheet <code><xsl:value-of select="$testname" /></code></h2>
|
||||
<xsl:apply-templates />
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="xsltu:test">
|
||||
<h3>Test <code><xsl:value-of select="@id" /></code></h3>
|
||||
<ul>
|
||||
<xsl:apply-templates />
|
||||
</ul>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="xsltu:assert">
|
||||
<li>
|
||||
Assert <code><xsl:value-of select="@id" /></code><xsl:text> ... </xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="@outcome = 'passed'">
|
||||
<span style="color:green">Passed</span>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<span style="color:red">Failed</span>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</li>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text()">
|
||||
<xsl:value-of select="normalize-space(translate(., '	 ', ''))" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="xsltu:no-match">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Expected:</td><td><code><xsl:value-of select="node[2]" /></code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Actual:</td><td><code><xsl:value-of select="node[1]" /></code></td>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
Reference in new issue
Block a user