[dsdl-comment] Re: nvdl context element usage

From: Dave Pawson <dave.pawson@gmail.com>
Date: Wed May 14 2008 - 08:48:18 UTC

2008/5/14 George Cristian Bina <george@oxygenxml.com>:
> Dave,
>
> The initial NVDL processing splits the document into sections. Each section
> contains elements (or attributes in case of attribute sections) all in the
> same namespace.

So the sections will be (using xpath notation)
/a:feed down to /a:entry/x:div
Since the atom schema *includes* the xhtml 'div' element (which I don't like)

then the x:p section (in the xhtml namespace)

and the 'context' of the current rule will be the xhtml div element
from which the x:p element can trigger

>From which it makes sense to use local-name() rather than a full nsname

> The context specifies a path inside a section, thus there is no need for
> qualified names as all the elements are in the same namespace. Plus you have
> the possibility to match the namespaces using wildcards so you may not even
> have a prefix defined for the matched namespace.

Can you think of an example of using a wildcard please?
the definition
 <define name="path">
    <data type="string">
      <param name="pattern">\s*(/\s*)?\i\c*(\s*/\s*\i\c*)*\s*(\|\s*(/\s*)?\i\c*(\s*/\s*\i\c*)*\s*)*</param>
    </data>
  </define>
doesn't seem to contain a * (as a wildcard?)

>
> Now, back to your sample... That is equivalent with an NVDL script without
> the context element. In order to allow XHTML content only inside the Atom
> content element then you need a script like

No (this is the bit I don't like about atom?)
the xhtml 'div' element is part of the atom schema!
This from the atom schema

 <define name="xhtmlDiv">
    <element name="xhtml:div">
      <zeroOrMore>
        <choice>
          <attribute>
            <anyName/>
          </attribute>
          <text/>
          <ref name="anyXHTML"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>

I have changed that for the schema I'm using, such that the xhtml:div is empty.

I note it is also part of the xhtml schema, which is where
I start to doubt it all :-)

Which section will xhtml:div be in! the atom section
or the xhtml section?

>
>
> <rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
> xmlns:a="http://www.w3.org/2005/Atom"
> xmlns:x="http://www.w3.org/1999/xhtml"
> startMode="doc"
> >
>
>
> <mode name="doc">
> <namespace ns="http://www.w3.org/2005/Atom">
> <validate schema="atom.rng" useMode="doc">
> <context path="/feed/entry/content" useMode="xhtml"/>
> </validate>
> </namespace>
> </mode>
>
>
> <mode name="xhtml">
> <namespace ns="http://www.w3.org/1999/xhtml">
> <validate schema="xhtml.sbp.rng" />
> </namespace>
> </mode>
> </rules>
>
> That is, keep the doc mode as default for the first validate action and
> change it only in the context of content if a new section starts inside it.

This is where the 'overlap' between atom and xhtml confuses me.
Which section will the 'div' element be in?

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 Wed May 14 10:48:24 2008

This archive was generated by hypermail 2.1.8 : Wed May 14 2008 - 10:23:03 UTC