[dsdl-discuss] Re: Does it make sense to allow <validate/> to borrow the semantics of <unwrap/>?

From: James Clark <jjc@jclark.com>
Date: Wed Dec 03 2003 - 08:40:58 UTC

On Mon, 2003-11-17 at 23:02, MURATA Makoto wrote:
...
> > Consider a fragment as follows.
> >
> > <table
> > <xforms:repeat id="lineset" nodeset="/my:lines/my:line">
> > <tr>
> > <td>
> > <xforms:input ref="my:price">
> > <xforms:label>Line Item</xforms:label>
> > </xforms:input>
> > </td>
> > </tr>
> > </xforms:repeat>
> > </table>
> >
> > where namespaces are defined by
> >
> > xmlns:xforms="http://www.w3.org/2002/xforms"
> > xmlns="http://www.w3.org/2002/06/xhtml2"
> >
> > .
> >
> > This document has five sections: <table>...</table>, <xforms:repeat>,
> > <tr>, and <xforms:input ref="my:price">. But we want to create two
> > validation candidates
> >
> > <xforms:repeat id="lineset" nodeset="/my:lines/my:line">
> > <xforms:input ref="my:price">
> > <xforms:label>Line Item</xforms:label>
> > </xforms:input>
> > </xforms:repeat>
> >
> > and
> >
> > <table>
> > <tr>
> > <td>
> > </td>
> > </tr>
> > </table>
> >

...
> > I tried the following schema, but it is incorrect since
> > the schema for NRL does not allow more than one <attach> or <unwrap>
> > element within a single <namespace> element.
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <rules startMode="root" xmlns="http://www.thaiopensource.com/validate/nrl">
> > <mode name="root">
> > <namespace ns="http://www.w3.org/2002/06/xhtml2">
> > <validate schema="xhtml2.rng"
> > useMode="nested"/>
> > </namespace>
> > <namespace ns="http://www.w3.org/2002/xforms">
> > <validate schema="XForms-Schema.xsd" useMode="nested"/>
> > <unwrap useMode="nested"/>
> > </namespace>
> > </mode>
> > <mode name="nested">
> > <namespace ns="http://www.w3.org/2002/06/xhtml2">
> > <attach/>
> > <unwrap/>
> > </namespace>
> > <namespace ns="http://www.w3.org/2002/xforms">
> > <attach/>
> > <unwrap/>
> > </namespace>
> > </mode>
> > </rules>

I think this schema can be modified to work. The root mode needs to be
split into a mode for the HTML root and a mode for the XForms root. It
also need two nested modes: one that extracts the HTML descendants and
one that extracts the XForms descendants. I think the following should
work, though I haven't tested it:

<rules xmlns="http://www.thaiopensource.com/validate/nrl"
startMode="root">
    <mode name="root">
        <namespace ns="http://www.w3.org/2002/06/xhtml2">
            <validate schema="xhtml2.rng" useMode="xforms-root"/>
        </namespace>
    </mode>

    <mode name="xforms-root" extends="get-html">
        <namespace ns="http://www.w3.org/2002/xforms">
            <validate schema="XForms-Schema.xsd" useMode="get-xforms"/>
            <unwrap useMode="get-html"/>
        </namespace>
    </mode>

    <mode name="get-html">
        <namespace ns="http://www.w3.org/2002/xforms">
            <unwrap/>
        </namespace>
        <namespace ns="http://www.w3.org/2002/06/xhtml2">
            <attach/>
        </namespace>
    </mode>

    <mode name="get-xforms">
        <namespace ns="http://www.w3.org/2002/xforms">
            <attach/>
        </namespace>
        <namespace ns="http://www.w3.org/2002/06/xhtml2">
            <unwrap/>
        </namespace>
    </mode>
</rules>

James

--
DSDL members discussion list
To unsubscribe, please send a message with the
command  "unsubscribe" to dsdl-discuss-request@dsdl.org
(mailto:dsdl-discuss-request@dsdl.org?Subject=unsubscribe)
Received on Wed Dec 3 09:45:18 2003

This archive was generated by hypermail 2.1.8 : Fri Dec 03 2004 - 14:00:28 UTC