XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Schematron and RNG, RNC

Alex Muir scripsit:

> Hi so a quick google search of
> 
> Embed schematron rules "relax-NC" -- 4 results none of any value
> verses
> Embed schematron rules "relax-NG" -- answer how to do it comes up
> 
> tells me that I'm only going to be able to Embed schematron rules
> "relax-NG" which is logical enough given the XML

Dr. Google, while informative, doesn't know everything.  If you read
http://relaxng.org/compact-tutorial-20030326.html#annotations , you
will find out how to embed arbitrary XML (which includes Schematron)
into RELAX NG compact syntax.  Basically, the syntax is to wrap each
XML element in square brackets.  The first thing in the square bracket
is the element name, anything that follows that looks like an attribute
is an attribute, and character data has to be quoted.

Also, .rnc format is normally called "RELAX NG compact syntax", not
"RELAX-NC".

So a Schematron rule like

   <sch:pattern>
      <sch:title>Date rules</sch:title>
      <sch:rule context="Contract">
         <sch:assert test="ContractDate &lt; current-date()">ContractDate should be in the past because future contracts are not allowed.</sch:assert>
      </sch:rule>
   </sch:pattern>

becomes

[sch:pattern
  [sch:title "Date rules"]
  [sch:rule context="Contract"
    [sch:assert test="ContractDate < current-date()"
      "ContractDate should be in the past because future contracts are not allowed."]]]

Clunky, but usable.  Trang understands this syntax when converting from
RNG to RNC and vice versa.

-- 
John Cowan          http://www.ccil.org/~cowan        cowan@ccil.org
To say that Bilbo's breath was taken away is no description at all.  There are
no words left to express his staggerment, since Men changed the language that
they learned of elves in the days when all the world was wonderful. --The Hobbit


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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS