[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Pure Union Type


Subject: Re: [xsl] Pure Union Type
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 4 May 2014 13:08:54 -0000

On 4 May 2014, at 03:30, Dimitre Novatchev dnovatchev@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> I am reading the XPath 3.0 Recommendation.
>
> The definition of "pure union type" is:
>
>
> "[Definition: A pure union type is an XML Schema union type that
> satisfies the following constraints: (1) {variety} is union, (2) the
> {facets} property is empty, (3) no type in the transitive membership
> of the union type has {variety} list, and (4) no type in the
> transitive membership of the union type is a type with {variety} union
> having a non-empty {facets} property].
>
> Note:
>
> The definition of pure union type excludes union types derived by
> non-trivial restriction from other union types, as well as union types
> that include list types in their membership. Pure union types have the
> property that every instance of an atomic type defined as one of the
> member types of the union is also a valid instance of the union type."
>
> My Questions:
> 1. In the phrase: "The definition of pure union type excludes union
> types derived by non-trivial restriction from other union types", what
> is meant to be a "non-trivial restriction"?

This is not part of the definition, it is an explanatory note about the
definition, so it's informal. The phrase "non-trivial restriction" is a gloss
on the statement that the facets property must be empty. It means that you
can't use a union type that's  derived from another union by restriction,
unless it's a "trivial" restriction - one with no restrictive facets.
>
> 2. Can somebody provide a meaningful example? For example, can we
> define a "my:numeric" pure union type as the union of xs:decimal,
> xs:integer, xs:float, xs:double, ..., etc ?

The simplest example would be

<xs:simpleType name="myUnion">
  <xs:union memberTypes="xs:decimal xs:double xs:float"/>
</xs:simpleType>

Michael Kay
Saxonica


Current Thread
Keywords