[Home] [By Thread] [By Date] [Recent Entries]

  • From: Rick Jelliffe <rjelliffe@a...>
  • To: xml-dev@l...
  • Date: Fri, 15 Aug 2008 12:22:38 +1000

I once had a variation on this: it was for new reports where each 
document had to have elements for <what>, <where>, <when>, <who> (and 
<how>), which a journalism professor was teaching as the essential 
elements that every professional story needed to provided.

So the constraints: five elements, where the document needed to have at 
least one of each in any order. The killer? The elements could be 
anywhere in the news report.

Obviously Schematron can do this trivially

  <rule context="/">
      <assert test="//what">A document should have at least one what 
</assert>
      <assert test="//where">A document should have at least one where 
</assert>
      <assert test="//when">A document should have at least one when 
</assert>
      <assert test="//who">A document should have at least one who </assert>
      <assert test="//how">A document should have at least one how</assert>
  </rule>

but it is not something that grammars (or, at least, grammars with 
non-path particles) can do.

Even in the case of XSD 1.1 assertions, which are a great addition 
(perhaps in the way that a cheesecake is great after a 50 course meal of 
crackers)  it is difficult, because these are not constraints that 
belong to types. They are constraints of the document of a class rather 
than of any elements: so in XSD you would have to artificially tie  
these to, say, a top-level element. In XSD it cannot be expressed as a 
pattern that exists in isolation from other particulars of the document. 
The pattern concept is more general than the type concept.

Cheers
Rick Jelliffe



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member