<xsd:key> or <xsd:unique> - no xform support?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

<xsd:key> or <xsd:unique> - no xform support?

lkbrown
There doesn't appear to be any support for <xsd:key> or <xsd:unique> in Orbeon.
I need to establish a primary key in my element to ensure that a valid and unique key is entered.

Here is an excerpt from my schema:

primary key:

  <xs:key name="idisPK">
          <xs:selector xpath="student"/>
        <xs:field xpath="@id"/>
        </xs:key>

I've also tried just using the unique constraints to see if that works. But no luck.

Unique:
       <xs:unique name="studentIDisUnique">
                <xs:selector xpath="student"/>
                <xs:field xpath="@id"/>
        </xs:unique>
       

Any help?
Reply | Threaded
Open this post in threaded view
|

Re: <xsd:key> or <xsd:unique> - no xform support?

gino-m
We worked around this with some help from the Orbeon developers.  Please see here for the solution.
Gino Miceli
Forest Information Systems Specialist
Food and Agriculture Organization of the United Nations
FAO-Finland Cooperation Programme
Sustainable Forest Management in a Changing Climate
Forest Management Division, Rm. D-406
Viale delle Terme di Caracalla, s.n.c.
00153 Rome, Italy
http://www.fao.org/forestry
Reply | Threaded
Open this post in threaded view
|

Re: <xsd:key> or <xsd:unique> - no xform support?

lkbrown
gino,

Your advice was excellent!

The previous post saved me days of frustration. I was able to make sure all my id attributes are unique by including the following line of code:

<xf:bind nodeset="//@id" constraint="for $current-id in . return count(//@id[. = $current-id]) = 1"/> 

My next two challenges are :

1) autoincrement an id when I create a new row

2) ensure that all keyref matches a key. that exists in another. potentially by a pulldown.