Re: Problem with its:version on its:rules

Martin Duerst wrote:

> Is your only request (in terms of syntax) that the namespace prefix
> be removed from its:version? I.e. would the following be okay with
> you:
> 
> <myRes>
>  <head>
>   <its:rules xmlns:its="http://www.w3.org/2005/11/its"
>    version="1.0" its:translate="no">

Yes, definitively.

>> As you can see there is its:translate="no" on its:rules to specify that
>> content of this element should not be translated. At the same time
>> version of ITS is specified by namespaced its:version attribute.
>>
>> This situation creates big problem for NVDL validation. In order to
>> attach required its:version attribute to its:rules element for
>> validation it is necessary to attach all attributes from ITS namespace
>> to its:rules element.
> 
> If this is so in general, it seems to be a serious limitation of NVDL.
> It would make it impossible to have two or more attributes in a namespace
> that are not always used together. It seems it would also create problems
> for somebody who wants to allow its:translate attributes on some elements
> of their DTD, and some other its attributes on some other elements, but
> not its:translate for those elements.

But in this situation you have to create your own schema/DTD which
integrates ITS markup anyway, and you must do it in the same way as it
is done in Best Practices document (for example XHTML+ITS, TEI+ITS, ...).

The advantage of NVDL is in situations when you don't have such
YourML+ITS schema available. You can still validate ITS markup in some
document using my NVDL schema without any additional effort needed for
creation YourML+ITS schema.

>> This will attach also its:translate attribute
>> which is of course not allowed on its:rules by ITS schema.
> 
> I don't understand this. If it also attaches the its:translate
> attribute, isn't that just what we want?

I was probably too short in explaining this. What we want to do is to
separate global ITS definitions (its:rules) from local ITS definitions
(@its:translate) before validation. And having version attribute in
namespace goes against this separation because it is not part of local
ITS definitions.

Imagine this very simplified instance:

<doc xmlns:its="http://www.w3.org/2005/11/its">
  <its:rules its:version="1.0" its:translate="no">
    ...
  </its:rules>
  <p>Translateable text</p>
  <q its:translate="no">Non-translateable text</q>
</doc>

The current NVDL schema for ITS will decompose this document into
following fragments for validation:

#1
<doc>
 <p>...</p>
 <q>...</q>
</doc>

#2
<its:rules its:version="1.0" its:translate="no">
  ...
</its:rules>

#3 (this comes from q element)
<... its:translate="no">

Fragment #1 will not be validated because it uses my custom markup. But
it is very easy to assign some particular schema to this fragment in
NVDL if necessary.

Fragment #2 should be validated against schema for <its:rules> element,
but current schemas for ITS doesn't allow its:translate attribute here.
So you will get error during validation.

Fragment #3 will be validated against special schema which allows to
appear ITS attributes (like its:translate, its:term) on any element.

If we will remove its:version from namespace (when used on its:rules)
situation will be much more better. NVDL schema doesn't have to attach
ITS attributes to its:rules anymore which will result in logical and
working situation:

<doc xmlns:its="http://www.w3.org/2005/11/its">
  <its:rules version="1.0" its:translate="no">
    ...
  </its:rules>
  <p>Translateable text</p>
  <q its:translate="no">Non-translateable text</q>
</doc>

NVDL schema would be now much more simpler:

<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0">

  <!-- Validation of global rules and span and ruby elements -->
  <namespace ns="http://www.w3.org/2005/11/its">
    <validate schema="its-elements.rng"/>
  </namespace>

  <!-- Validation of local use attributes -->
  <namespace ns="http://www.w3.org/2005/11/its" match="attributes">
    <validate schema="its-attributes.rng"/>
  </namespace>

  <!-- Non-ITS markup is ignored -->
  <anyNamespace>
    <allow/>
  </anyNamespace>

</rules>

NVDL will decompose the document into the following fragments for
validation:

#1
<doc>
 <p>...</p>
 <q>...</q>
</doc>

#2
<its:rules version="1.0">
  ...
</its:rules>

#3 (this comes from its:rules element)
<... its:translate="no">

#4 (this comes from q element)
<... its:translate="no">

All fragments #2, #3 and #4 can be validated against ITS schema without
problems.

Of course, doing change from its:version to version only to accommodate
some particular validation approach is not reasonable. But we should
make this change to make markup design of ITS more clean and consistent
with markup best practices. Namespaced attributes should be used only
for attributes which are orthogonal to elements on which they appear.
This is case of its:translate and similar attributes. You can find many
examples of such attributes in other W3C specs -- e.g. xlink:href,
xsi:type, xsi:schemaLocation -- those attributes can appear on any
element. But when you specify version of ITS on its:rules element you
should not use general attribute, but attribute specific for its:rules
which means attribute in no-namespace.

Of course if you do not have its:rules element in your document you must
use namespaced its:version attribute to assign ITS version information
to instance. But this is different story. And having both its:version
and version attribute is not problem, the same approach was used in XSLT
which is probably the most successful application of XML.

I hope that I have made my point clearer now, but if not, then it is my
fault and please ask more questions.

   Jirka

-- 
------------------------------------------------------------------
  Jirka Kosek     e-mail: jirka@kosek.cz     http://www.kosek.cz
------------------------------------------------------------------
  Profesionální školení a poradenství v oblasti technologií XML.
     Podívejte se na náš nově spuštěný web http://DocBook.cz
       Podrobný přehled školení http://xmlguru.cz/skoleni/
------------------------------------------------------------------
                   Nejbližší termíny školení:
** XML pro vývojáře 19.-22.3.2007 ** XML schémata 16.-18.4.2007 **
        ** XSL-FO 15.-16.5.2007 ** DocBook 26.-28.6.2007 **
------------------------------------------------------------------
  http://xmlguru.cz    Blog mostly about XML for English readers
------------------------------------------------------------------

Received on Tuesday, 30 January 2007 10:20:30 UTC