IDness has three constraints
1) It is an NCName
2) There are not two ID attributes in the same element
3) The ID value is document-unique.
IDREFness has two constraints
1) It is an NCName
2) There is a corresponding ID attribute.
Schematron has a difficulty with this this *formulation* of the
definition, because of the circularity of the definition of 2) for
IDness. It is based allocating a type definition to nodes (ID) and
being able to retrieve this statically or dynamically.
In Schematron the way to formulat this is by saying that IDness is a
pattern, true of the whole document, *not* some kind of magic property
of the attribute or element. The following is a simple example in
(rough, probably wrong) XPath2:
<pattern id="ids">
<title>IDs</title>
<let name="theIDnodes" value="/bar/baz/@id | ...." />
<rule context="/bar/baz/@ID" role="ID">
<assert test="xs:NCName(.)">
1) An ID attribute should be an XML non-colonized name.
</assert>
<assert test="count(unique($theIDnodes/..))">
2) No element should have more than a single ID attribute.
</assert>
<assert test="count($theIDnodes = .) = 1">
3) There should be no ID attributes with duplicate values.
</assert>
</rule>
...
</pattern>
Cheers
Rick
MURATA Makoto wrote:
> Let's make sure whether Schematron does the job.
> Consider the following schema. It is correct (as defined by the RNG
> spec) but not compatible (as defined by the DTD compatibility spec).
>
> start = element foo {bar1, bar2, ttt*}
> bar1 = element bar1 {baz1}
> bar2 = element bar2 {baz2}
> baz1 = element baz {attribute id { ID }, xsd:string}
> baz2 = element baz {xsd:int}
> ttt = element ttt {attribute ref { IDREF } }
>
> In Schematron, how can we say the following conditions?
>
> 1) bar/baz/@id are identifiers
> 2) ttt/@ref references to the identifiers
>
> Application programmers can easily write programs for maintaining
> hath tables if they understand 1) and 2).
>
> If Schematron can meet the challenge, I am not sure if we need something
> more.
>
> Cheers,
>
>
-- DSDL members discussion list To unsubscribe, please send a message with the command "unsubscribe" to dsdl-discuss-request@dsdl.org (mailto:dsdl-discuss-request@dsdl.org?Subject=unsubscribe)Received on Mon May 12 10:43:46 2008
This archive was generated by hypermail 2.1.8 : Mon May 12 2008 - 13:33:01 UTC