Skip to content

Commit bc0020b

Browse files
author
Weiwu Zhang
authored
Merge pull request #388 from AlphaWallet/distinct
Distinct
2 parents 656935f + 1faec47 commit bc0020b

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

schema/tokenscript.xsd

+27-21
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@
4747
<element ref="ts:cards"/>
4848
<element minOccurs="0" ref="ts:grouping"/>
4949
<element minOccurs="0" ref="ts:ordering"/>
50-
<element minOccurs="0" maxOccurs="unbounded" ref="ts:attribute"/>
50+
<element name="attribute" minOccurs="0" maxOccurs="unbounded" type="ts:attributeWithDistinct"/>
5151
<element minOccurs="0" maxOccurs="unbounded" ref="dsig:Signature"/>
5252
</sequence>
5353
<attribute name="custodian" type="boolean" default="false"/>
5454
<attribute name="name" type="NCName"/>
55+
<assert test="count(ts:attribute[string(@distinct) = 'true']) le 1"/>
56+
<assert test="if(not(ts:origins)) then count(ts:attribute[string(@distinct) = 'true']) = 1 else true()"/>
5557
</complexType>
5658
<keyref name="typeRef" refer="ts:namedTypeName">
5759
<selector xpath=".//ts:origins/ethereum:event|.//ts:origins/ethereum:call"></selector>
@@ -90,7 +92,7 @@
9092
<sequence>
9193
<element minOccurs="0" name="label" type="ts:text"/>
9294
<element minOccurs="0" ref="ts:origins"/>
93-
<element minOccurs="0" maxOccurs="unbounded" ref="ts:attribute"/>
95+
<element name="attribute" minOccurs="0" maxOccurs="unbounded" type="ts:attribute"/>
9496
<element minOccurs="0" maxOccurs="unbounded" ref="ts:selection"/>
9597
<!-- consider putting input and output in transaction
9698
declaration later when/if DvP Security is
@@ -253,25 +255,29 @@
253255
<attribute name="field" use="required" type="NCName"/>
254256
</complexType>
255257
</element>
256-
<element name="attribute">
257-
<complexType>
258-
<sequence>
259-
<element name="type">
260-
<complexType>
261-
<sequence>
262-
<element name="syntax"/>
263-
</sequence>
264-
</complexType>
265-
</element>
266-
<!-- label is not needed if the attribute is only used for selection -->
267-
<element minOccurs="0" name="label" type="ts:text"/>
268-
<element ref="ts:origins"/>
269-
</sequence>
270-
<attribute name="name" use="required" type="NCName"/>
271-
<attribute name="distinct" type="boolean" default="false"/>
272-
<attribute name="oid" type="NMTOKEN"/>
273-
</complexType>
274-
</element>
258+
<complexType name="attribute">
259+
<sequence>
260+
<element name="type">
261+
<complexType>
262+
<sequence>
263+
<element name="syntax"/>
264+
</sequence>
265+
</complexType>
266+
</element>
267+
<!-- label is not needed if the attribute is only used for selection -->
268+
<element minOccurs="0" name="label" type="ts:text"/>
269+
<element ref="ts:origins"/>
270+
</sequence>
271+
<attribute name="name" use="required" type="NCName"/>
272+
<attribute name="oid" type="NMTOKEN"/>
273+
</complexType>
274+
<complexType name="attributeWithDistinct">
275+
<complexContent>
276+
<extension base="ts:attribute">
277+
<attribute name="distinct" type="boolean" default="false"/>
278+
</extension>
279+
</complexContent>
280+
</complexType>
275281
<simpleType name="syntax">
276282
<restriction base="NMTOKEN">
277283
<enumeration value="1.3.6.1.4.1.1466.115.121.1.7"/><!-- Boolean -->

0 commit comments

Comments
 (0)