| 1 | # A RelaxNG schema for TNTBase Specifications for Virtual Documents |
|---|
| 2 | # $Id$ |
|---|
| 3 | # $HeadURL$ |
|---|
| 4 | # See the documentation and examples at http://www.omdoc.org |
|---|
| 5 | # Copyright (c) 2010 Vyacheslav Zholudev, released under the Apache 2.0 License |
|---|
| 6 | |
|---|
| 7 | default namespace tnt = "http://tntbase.mathweb.org/ns" |
|---|
| 8 | |
|---|
| 9 | #common definitions |
|---|
| 10 | id.attrib = attribute xml:id {xsd:string} |
|---|
| 11 | name.attrib = attribute name {text} |
|---|
| 12 | query.attrib = attribute query {text} |
|---|
| 13 | href.attrib = attribute href {xsd:string {minLength = "1"}} |
|---|
| 14 | any.attrib = attribute * {xsd:string} |
|---|
| 15 | any.el = element * {(any.attrib*, any.el*) & text*} |
|---|
| 16 | |
|---|
| 17 | #query elements - inside the skeleton and outside |
|---|
| 18 | query.outside.el = element query {name.attrib, (xsd:string {minLength = "1"} | href.attrib)} |
|---|
| 19 | query.inside.el = element query {name.attrib | xsd:string {minLength = "1"} | href.attrib} |
|---|
| 20 | |
|---|
| 21 | #root element of VD specification |
|---|
| 22 | virtualdocument = element virtualdocument {id.attrib?, virtualdocument.model} |
|---|
| 23 | virtualdocument.model = skeleton, (query.outside.el* & params?) |
|---|
| 24 | |
|---|
| 25 | #skeleton element - either empty with reference to another skeleton or with "meat" |
|---|
| 26 | skeleton = element skeleton {id.attrib? & (skeleton.model | href.attrib)} |
|---|
| 27 | #the skeleton should contain exactly one non tnt element as a child |
|---|
| 28 | skeleton.model = element * - tnt:* {xqel* & any.attrib* & text*} |
|---|
| 29 | |
|---|
| 30 | #typical element of a skeleton - either tnt:xqinclude or arbitrary non-tnt element ot text |
|---|
| 31 | xqel = xq | element * - tnt:* {xqel* & any.attrib* & text*} |
|---|
| 32 | |
|---|
| 33 | #tnt:xqinclude element - should contain a query as an attribute, or have a child tnt:query |
|---|
| 34 | #Query as element should reference a query or contain a query as a text |
|---|
| 35 | #The second allowed element is tnt:return |
|---|
| 36 | xq = element xqinclude {(query.attrib | query.inside.el) , return.el} |
|---|
| 37 | |
|---|
| 38 | #tnt:return element and its children |
|---|
| 39 | return.el = element return {return.internal.el*} |
|---|
| 40 | return.internal.el = result.el | text* | element * - tnt:* {return.internal.el* & any.attrib*} |
|---|
| 41 | result.el = element result {empty} |
|---|
| 42 | |
|---|
| 43 | #parameters |
|---|
| 44 | params = element params {param+} |
|---|
| 45 | param = element param{name.attrib, value+} |
|---|
| 46 | value = element value {xsd:string {minLength = "1"}} |
|---|
| 47 | |
|---|
| 48 | #virtualdocument is the root element |
|---|
| 49 | start = virtualdocument |
|---|