[dsdl-comment] Re: context element.

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

Innovimax SARL wrote:
> I suppose you speak about the context element of NVDL ?
>
> I see it as element for "matching" context and allowing special
> behavior of the script for this special context (a simple XPath)
>
> I can't see your trouble around this element
>
The confusion I had was that the spec doesn't seem to describe the
element. It then occurred to me to see if it is described in NRL. James
Clark's NRL tutorial:

http://www.thaiopensource.com/relaxng/nrl.html#Element-name_context

describes context, and the behavior of oNVDL seems to match that
description, I'm having trouble with jnvdl.sh so I haven't tried jnvdl yet.

Incidentally, for Petr and Jirka, the tutorial on http://jnvdl.sf.net is
helpful, but I was confused by some of the wording:

"Section's context path begins at its parent section root element and
includes every local element name unless it reaches the parent element
of the section."

That sounds to me like path="p" would match a section root element named
"p". Whereas the the NRL tutorial says:

"The 'path' attribute specifies a test to be applied to the parent
element of the section to be processed."

which I find easier to understand as meaning that path="p" would match
the section's parent element, not the parent section's root element.

Also, the wording:

"If preceded by a path separator the choice is considered to be an
absolute path (a path from the root element) otherwise the path is
relative."

I'm not sure in which direction the path is being said to be relative.
Whereas in the NRL tutorial:

"...a path of '/foo' means a 'foo' element that is the root of a section..."

Matches the behavior that I see with oNVDL. For example, context makes
quote be allowed in note/p but not in p otherwise:

doc.rnc:

start = element doc { sec }
sec = element sec { (p | note)* }
p = element p { empty }
note = element note { p* }

quote.rnc:

namespace q = "http://quote"
start = element q:quote { text }

context.nvdl:

<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
 xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
schemaType="application/x-rnc"
 startMode="root">
 <mode name="root">
   <namespace ns="">
     <validate schema="doc.rnc">
       <context path="note/p" useMode="quote"/>
     </validate>
   </namespace>
 </mode>
 <mode name="quote">
   <namespace ns="http://quote">
     <validate schema="quote.rnc"/>
   </namespace>
 </mode>
</rules>

test.xml:

<doc>
 <sec>
   <p><quote xmlns="http://quote"/></p><!-- error: quote not allowed
here -->
   <note>
     <p>
       <quote xmlns="http://quote"/><!-- quote allowed here -->
     </p>
   </note>
 </sec>
</doc>

So, I think the spec should include detail about the context element.

Kendall

> May be with some materials or examples, we can go through it ?
>
> Mohamed
>
> On 8/10/07, Dave Pawson <dave.pawson@gmail.com> wrote:
>
>> I've just been exchanging emails with Kendall Shaw re the context element.
>>
>> We're trying to work out *why* it is there, and the specification isn't helpful,
>> from a user view.
>>
>> Anyone have a clear definition please?
>>
>> Rather than put one view forward, I'd like to hear what others think
>> its purpose is please?
>>
>> TIA
>>
>> --
>> 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)
>>
>>
>>
>
>
>

--
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:52:35 2007

This archive was generated by hypermail 2.1.8 : Mon Aug 13 2007 - 09:23:02 UTC