[dsdl-comment] triggers and order of elements

From: Kendall Shaw <queshaw@pacbell.net>
Date: Fri Aug 10 2007 - 18:20:54 UTC

Hi,

If I understand correctly, to validate sections created by triggers, you
have to specify the order in which the elements named in the trigger
namelist are expected to occur in the nvdl script. For example, if you
have a document type in which elements in no namespace are allowed, and
they are valid against separate schemata, using triggers you have to
specify where in document order you expect the elements to occur:

doc.rnc:

namespace d = "http://doc"

start = element d:doc { empty }

table.rnc:

start = element table { empty }

dlist.rnc:

start = element dlist { empty }

triggers.nvdl:

<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
 xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
startMode="root"
 schemaType="application/x-rnc">
 <trigger ns="" nameList="table"/>
 <trigger ns="" nameList="dlist"/>
 <mode name="root">
   <namespace ns="http://doc">
     <validate schema="doc.rnc" useMode="dlist"/> <!-- I have to pick
one mode here -->
   </namespace>
 </mode>
 <mode name="dlist">
   <namespace ns="">
     <validate schema="dlist.rnc" useMode="table"/>
   </namespace>
 </mode>
 <mode name="table">
   <namespace ns="">
     <validate schema="table.rnc" useMode="dlist"/>
   </namespace>
 </mode>
</rules>

It seems that you have to choose whether you expect the next section to
be a "table section" or a "dlist section":

valid.xml :

<d:doc xmlns:d="http://doc">
 <dlist/>
</d:doc>

invalid.xml :

<d:doc xmlns:d="http://doc">
 <table/><!-- error: table not allowed -->
</d:doc>

valid2.xml:

<d:doc xmlns:d="http://doc">
 <dlist><table/></dlist>
</d:doc>

invalid2.xml :

<d:doc xmlns:d="http://doc">
 <table><dlist/></table> <!-- error: table not allowed -->
</d:doc>

I don't see how to allow the triggered sections to be siblings either:

invalid3.xml:

<d:doc xmlns:d="http://doc">
 <dlist/>
 <table/> <!-- error: table not allowed -->
</d:doc>

Have I understood correctly? If so, would it be a good idea if NVDL
allowed you to specify the local name as well as the namespace? For
example, with something like the made up "section-root" element below:

<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
 xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
startMode="root"
 schemaType="application/x-rnc">
 <trigger ns="" nameList="table"/>
 <trigger ns="" nameList="dlist"/>
 <mode name="root">
   <namespace ns="http://doc">
     <validate schema="doc.rnc" useMode="triggered"/>
   </namespace>
 </mode>
 <mode name="triggered">
   <section-root ns="" name="dlist"> <
     <validate schema="dlist.rnc"/>
   </section-root>
   <section-root ns="" name="table">
     <validate schema="table.rnc"/>
   </section-root>
 </mode>
</rules>

Kendall

--
DSDL comments
To unsubscribe, please send a message with the
command  "unsubscribe" to dsdl-comment-request@dsdl.org
(mailto:dsdl-comment-request@dsdl.org?Subject=unsubscribe)
Received on Fri Aug 10 20:28:38 2007

This archive was generated by hypermail 2.1.8 : Fri Aug 10 2007 - 18:53:02 UTC