summaryrefslogtreecommitdiff
path: root/xstc/xstc-to-python.xsl
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2004-10-13 08:57:08 +0000
committerMike Hommey <mh@glandium.org>2004-10-13 08:57:08 +0000
commit0732be88d054db33fa0ca479eab9988c8e6be42e (patch)
tree8b9cf70e04bd32115caebeb74cb0d841d1eced3b /xstc/xstc-to-python.xsl
parent09deb06614c3408ec0816a3c88920138bae2083c (diff)
downloadlibxml2-0732be88d054db33fa0ca479eab9988c8e6be42e.tar.gz
Load /tmp/tmp.zzO3vU/libxml2-2.6.14 intoupstream/2.6.14
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'xstc/xstc-to-python.xsl')
-rw-r--r--xstc/xstc-to-python.xsl65
1 files changed, 65 insertions, 0 deletions
diff --git a/xstc/xstc-to-python.xsl b/xstc/xstc-to-python.xsl
new file mode 100644
index 0000000..31fe038
--- /dev/null
+++ b/xstc/xstc-to-python.xsl
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+ <xsl:output method="text"/>
+ <!-- Main template. -->
+ <xsl:template match="/">
+ <xsl:text>#!/usr/bin/python -u
+#
+# This file is generated from the W3C test suite description file.
+#
+
+from xstc import MSTestRunner, MSTestCase
+
+r = MSTestRunner()
+
+</xsl:text>
+ <xsl:apply-templates select="tests/test"/>
+ <xsl:text>
+
+r.run()
+
+##################
+# Display results.
+#
+
+</xsl:text>
+
+ </xsl:template>
+
+ <!-- Test template. -->
+
+ <xsl:template match="file">
+ <xsl:text>"</xsl:text>
+ <xsl:value-of select="@folder"/><xsl:text>", "</xsl:text>
+ <xsl:value-of select="@fileName"/><xsl:text>", </xsl:text>
+ <xsl:value-of select="@validity"/>
+ </xsl:template>
+
+ <xsl:template match="test">
+ <xsl:text>r.addTest(MSTestCase("</xsl:text>
+ <xsl:value-of select="@id"/>
+ <xsl:text>", """</xsl:text>
+ <xsl:value-of select="description/text()"/>
+ <xsl:text>""", "</xsl:text>
+ <xsl:value-of select="files/file[@role='schema']/@tsDir"/>
+ <xsl:text>", </xsl:text>
+ <xsl:choose>
+ <xsl:when test="count(files/file[@role='schema']) = 1">
+ <xsl:apply-templates select="files/file[@role='schema']"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>"", "", 0</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="count(files/file[@role='instance']) = 1">
+ <xsl:text>, 1, </xsl:text>
+ <xsl:apply-templates select="files/file[@role='instance']"/>
+ </xsl:when>
+ <xsl:otherwise>, 0, "", "", 0</xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>))
+</xsl:text>
+ </xsl:template>
+
+</xsl:stylesheet>