我想對xsd:complexType
進行限制,只包含0.5
至20
之間的值,包括兩者,步驟爲0.5
。這意味着數字:XSD允許一半加倍
0.5 1 1.5 2 2.5 3 3.5 .. up to 20
我的代碼是在這裏:
<xsd:complexType name="skillType">
<xsd:simpleContent>
<xsd:extension base="skillHalfDoubleType">
<xsd:attribute name="special">
<!-- Irrelevant attribute -->
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="skillHalfDoubleType">
<xsd:restriction base="xsd:double">
<!-- What more? -->
</xsd:restriction>
</xsd:simpleType>
這是可能的應用上xsd:string
正則表達式來做到這一點,但我期待與限制xsd:double
的解決方案。
或者您可以有minInclusive方面,maxInclusive方面和斷言方面round($ value * 2)= $ value * 2 '來測試它是0.5的倍數。 –