[dsdl-comment] Re: Section with a child section (whichis attachedto its parent), and the child section itself has a child section (which isnotattached to its parent)

From: Dave Pawson <dave.pawson@gmail.com>
Date: Fri May 23 2008 - 07:39:33 UTC

Hi George.

2008/5/23 George Cristian Bina <george@oxygenxml.com>:
> Hi Dave,
>
> The script below should do that:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
> xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
> startMode="start">
> <mode name="start">
> <namespace ns="http://a">
> <validate schema="a.xsd" useMode="B"/>
> </namespace>
> </mode>
> <mode name="B">
> <namespace ns="http://b">
> <validate schema="b.xsd"/>
> </namespace>
> </mode>
> </rules>
>
> This will basically allow a document to start with the first namespace to
> contain content in the second namespace.

ab.xml

<a xmlns="http://A">
  <b xmlns="http://B">text</b>
</a>

ab.nvdl
<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
 xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
startMode="start">
   <mode name="start">
       <namespace ns="http://A">
           <validate schema="a.rng" useMode="B"/>
       </namespace>
   </mode>
   <mode name="B">
       <namespace ns="htp://B">
           <validate schema="b.rng"/>
       </namespace>
   </mode>
</rules>

a.rng
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         ns="http://A">
<start>
    <ref name="a"/>
</start>
<define name="a">
  <element name="a">
<text/> <!--Also fails if I make this empty-->
  </element>
</define>
</grammar>

b.rng
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         ns="http://B">
<start>
    <ref name="b"/>
</start>
<define name="b" >
  <element name="b">
    <text/>
  </element>
</define>
</grammar>

Error.
ab.xml:3:23: error: elements from namespace "http://B" are not allowed

I think this shows the point I referred to? The entire instance must be valid
to the 'A' schema? I can't specify a schema for the outer element
which 'ignores' the inner one?
I'm unsure now if this is a Relax issue or NVDL.

regards

-- 
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk
--
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 May 23 09:39:36 2008

This archive was generated by hypermail 2.1.8 : Fri May 23 2008 - 08:03:19 UTC