W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2002

Key/IDREF checking as a pattern fragment

From: Stuart Brown <sbrown@extenza.com>
Date: Fri, 29 Nov 2002 14:00:32 -0000
Message-ID: <41CBE3F57CE3D3118F2F00508B8BA22B0434104A@sbis-uk-1.uk.swetsblackwell.com>
To: xmlschema-dev@w3.org

Hi there,

I have an element which, in its content, I wish to be able to construct a
function sequence which references other elements.  I am currently using the
following construct:

<xsd:element name="def">
  <xsd:attribute name="id" type="xsd:ID"/>

<xsd:element name="implement">
  <xsd:choice minOccurs="0" maxOccurs="unbounded">
   <xsd:element name="doThis">
     <xsd:attribute name="use" type="xsd:IDREF"/>
   <xsd:element name="doThat">
     <xsd:attribute name="use" type="xsd:IDREF"/>
   <xsd:element name="doSomethingElseEntirely">
     <xsd:attribute name="use" type="xsd:IDREF"/>

Which allows me the following example content:

<def id="DEF1"/>
<def id="DEF2"/>
<def id="DEF3"/>
 <doThis use="DEF1"/>
 <doThat use="DEF2"/>
 <doSomethingElseEntirely use="DEF3"/>

However, for the sake of brevity in my instance XML, I would like to be able
to concatenate the do* elements and represent them as an attribute in the
<implement> element, something like the following:

<implement do="doThis(DEF1),doThat(DEF2),doSomethingElseEntirely(DEF3)"/>

I can write a xsd:restriction pattern for the attribute simple type as


which (I hope) enforces the function names, the parens, and a requirement
that the content of the parens by characters permitted by xsd:NMTOKEN only,
but (and I bet you saw this coming) is there any way that I can enforce the
parens contents to be IDREFs?  At the moment I am contemplating either
leaving it with my clunky element sequence, or using the above pattern and
providing additional Schematron (or sim.) validation for the key validation.

Any suggestions would be gratefully received,

Received on Friday, 29 November 2002 09:05:39 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:07 UTC