[dsdl-comment] Re: nvdl patterns

From: Kendall Shaw <queshaw@pacbell.net>
Date: Thu Aug 09 2007 - 06:20:28 UTC

Dave Pawson wrote:
> I'm looking for the major usage patterns for NVDL.
>
> So far I can describe two major ones. I've given them names simply to
> refer to them.
>
> 1. The layer pattern. Schema B wraps schema A. e.g. XSLT wrapping XHTML.
>
> 2. The foreign block pattern. Minor inserts of Schema B in Schema A.
> e.g. SVG in XSL-FO.
>
> Are there any that are major variations on these two?
It looks like it can allow you to make a grammar based schema easier to
understand, by allowing you to leave out arbitrary elements/attributes.
Actually I thought something like that was described as a use case in a
quote from Murata Makoto on your NVDL background page.

For example, instead of interleaving arbitrary elements/attributes:

> ambig.rnc:

namespace x = "http://x"
start = doc
doc = element x:doc { sec }
sec = element x:sec { lit }
lit = element x:lit { empty & foreign }
foreign = (element * - x:* { foreign } | attribute * { text } | text)*

You could leave that out:

> nonambig.rnc:

namespace x = "http://x"
start = doc
doc = element x:doc { sec }
sec = element x:sec { lit }
lit = element x:lit { empty }

by using NVDL to allow the arbitrary elements/attributes:

> ambig.nvdl:

<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
  schemaType="application/x-rnc" startMode="start">
  <mode name="start">
    <namespace ns="http://x">
      <validate schema="nonambig.rnc">
        <context path="lit" useMode="lit"/>
      </validate>
    </namespace>
  </mode>
  <mode name="lit">
    <anyNamespace match="attributes elements"><unwrap/></anyNamespace>
  </mode>
</rules>

An instance, with an arbitrary element and attribute:

> test.xml:

<x:doc xmlns:x="http://x">
  <x:sec>
    <x:lit a="1">
      <b>c</b>
    </x:lit>
  </x:sec>
</x:doc>

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 Thu Aug 9 13:12:18 2007

This archive was generated by hypermail 2.1.8 : Fri Aug 10 2007 - 09:03:02 UTC