Hash :
7b72ee5c
Author :
Date :
2003-02-27T23:24:53
fixed a node dump crash on attributes fixed an URI test bug and get better * tree.c: fixed a node dump crash on attributes * test/xsdtest/xsdtest.xml test/xsdtest/xsdtest.xsl: fixed an URI test bug and get better output. Daniel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="xsdtest datatype equiv class"/>
<xsl:output indent="yes" encoding="utf-8"/>
<xsl:template match="xsdtest">
<testSuite>
<xsl:apply-templates/>
</testSuite>
</xsl:template>
<xsl:template match="datatype">
<testSuite>
<documentation>Datatype <xsl:value-of select="@name"/></documentation>
<testCase>
<requires datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"/>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="doc"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<data type="{@name}">
<xsl:for-each select="param">
<param name="{@name}"><xsl:value-of select="."/></param>
</xsl:for-each>
</data>
</element>
</correct>
<xsl:apply-templates select="valid|invalid"/>
</testCase>
<xsl:apply-templates select="equiv/class|length|lessThan|incomparable"/>
</testSuite>
</xsl:template>
<xsl:template match="valid">
<xsl:call-template name="valid"/>
</xsl:template>
<xsl:template match="invalid">
<xsl:call-template name="invalid"/>
</xsl:template>
<xsl:template name="valid">
<valid>
<xsl:apply-templates select="@internalSubset"/>
<doc>
<xsl:copy-of select="namespace::*"/>
<xsl:value-of select="."/>
</doc>
</valid>
</xsl:template>
<xsl:template name="invalid">
<invalid>
<xsl:apply-templates select="@internalSubset"/>
<doc>
<xsl:copy-of select="namespace::*"/>
<xsl:value-of select="."/>
</doc>
</invalid>
</xsl:template>
<xsl:template match="@internalSubset">
<xsl:param name="doc" select="'doc'"/>
<xsl:attribute name="dtd">
<xsl:text>
<!DOCTYPE </xsl:text>
<xsl:value-of select="$doc"/>
<xsl:text> [
</xsl:text>
<xsl:value-of select="."/>
<xsl:text>
]></xsl:text>
</xsl:attribute>
</xsl:template>
<xsl:template match="class">
<testCase>
<correct>
<xsl:for-each select="value[1]">
<xsl:apply-templates select="@internalSubset">
<xsl:with-param name="doc">element</xsl:with-param>
</xsl:apply-templates>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="doc"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<value>
<xsl:copy-of select="namespace::*"/>
<xsl:attribute name="type"><xsl:value-of select="../../../@name"/></xsl:attribute>
<xsl:value-of select="."/>
</value>
</element>
</xsl:for-each>
</correct>
<xsl:for-each select="value[position() != 1]">
<xsl:call-template name="valid"/>
</xsl:for-each>
<xsl:for-each select="preceding-sibling::class/value|following-sibling::class/value">
<xsl:call-template name="invalid"/>
</xsl:for-each>
</testCase>
</xsl:template>
<xsl:template match="length">
<testCase>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="doc"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<data type="{../@name}">
<param name="length"><xsl:value-of select="@value"/></param>
</data>
</element>
</correct>
<xsl:call-template name="valid"/>
</testCase>
<testCase>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="doc"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<data type="{../@name}">
<param name="length"><xsl:value-of select="@value + 1"/></param>
</data>
</element>
</correct>
<xsl:call-template name="invalid"/>
</testCase>
<xsl:if test="@value != 0">
<testCase>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="doc"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<data type="{../@name}">
<param name="length"><xsl:value-of select="@value - 1"/></param>
</data>
</element>
</correct>
<xsl:call-template name="invalid"/>
</testCase>
</xsl:if>
</xsl:template>
<xsl:template match="lessThan">
<testCase>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="doc"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<data type="{../@name}">
<param name="minExclusive">
<xsl:value-of select="value[1]"/>
</param>
</data>
</element>
</correct>
<valid>
<doc>
<xsl:value-of select="value[2]"/>
</doc>
</valid>
<invalid>
<doc>
<xsl:value-of select="value[1]"/>
</doc>
</invalid>
</testCase>
<testCase>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="doc"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<data type="{../@name}">
<param name="minExclusive">
<xsl:value-of select="value[2]"/>
</param>
</data>
</element>
</correct>
<invalid>
<doc>
<xsl:value-of select="value[1]"/>
</doc>
</invalid>
<invalid>
<doc>
<xsl:value-of select="value[2]"/>
</doc>
</invalid>
</testCase>
</xsl:template>
<xsl:template match="incomparable">
<testCase>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="doc"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<data type="{../@name}">
<param name="minExclusive">
<xsl:value-of select="value[1]"/>
</param>
</data>
</element>
</correct>
<invalid>
<doc>
<xsl:value-of select="value[2]"/>
</doc>
</invalid>
<invalid>
<doc>
<xsl:value-of select="value[1]"/>
</doc>
</invalid>
</testCase>
<testCase>
<correct>
<element xmlns="http://relaxng.org/ns/structure/1.0" name="doc"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<data type="{../@name}">
<param name="minExclusive">
<xsl:value-of select="value[2]"/>
</param>
</data>
</element>
</correct>
<invalid>
<doc>
<xsl:value-of select="value[1]"/>
</doc>
</invalid>
<invalid>
<doc>
<xsl:value-of select="value[2]"/>
</doc>
</invalid>
</testCase>
</xsl:template>
</xsl:stylesheet>