Jump to content

Automatic transformation of XML namespaces/RDF resource format/Grouping examples

From Wikiversity

This section is non-normative.

Consider the following syntaxes:

<a:section>
  <a:title>...</a:title>
  ...
</a:section>

and

<b:section>
  <b:title>...</b:title>
  ...
</b:section>

(It may be transformed in HTML with h2 elements.)

Consider two transformations between namespaces a and b, which map corresponding elements from a to b and back.

But then the following would not work:

<a:section>
  <b:title>...</b:title>
  ...
</a:section>

This means that both a (http://example.org/namespace/a) and b (http://example.org/namespace/b) namespaces are grouped by descendants. (That is an element may have meaning only together with its descendants.) It is conceivable to write:

http://example.org/namespace/a a :GroupedWithDescendants .
http://example.org/namespace/b a :GroupedWithDescendants .

Sometimes elements may be grouped even when neither is a descendant of the another:

<a:title>Test 1</a:title>
...
<a:title>Test 2</a:title>

When converting this to HTML, chapter numbers may be added.

This is described as :GroupedAll class. This class is the default.

Probably most of XML formats should use :NotGrouped class but using :GroupedAll class by default is more safe.

So, a namespace is of :GroupedAll class if not explicitly specified.

:GroupedAll is a subclass of :GroupedWithDescendants which in turn is a subclass of :NotGrouped.