Login  Register

RE: Re: RE: Using XSD-IDREFS/-ID typed elements to identify relevant elements

Posted by Thorsten Stumpf on Mar 03, 2011; 4:33pm
URL: https://discuss.orbeon.com/Using-XSD-IDREFS-ID-typed-elements-to-identify-relevant-elements-tp3328493p3333680.html

Hi!

 

Yes, we run an XForms page and this page operates on documents (instances in a XForms model) wherein different nodes reference other nodes based on ids.

Though that’s not the answer I hoped for ;-) it clarifies why it does not work!

 

We can handle that by other XPath 2.0 expressions but these are way more complicated than the id()-option.

 

Thanks for the information!

 

Of course: Resources are limited – I perfectly understand that. Just didn’t know the XPath processor is not scheme aware…

Are there any plans to implement the id()-function?

 

Regards

 

JT

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Erik Bruchez
Sent: Thursday, March 03, 2011 9:04 AM
To: [hidden email]
Subject: [ops-users] Re: RE: Using XSD-IDREFS/-ID typed elements to identify relevant elements

 

Since you mention that a schema is in use, I assume the XPath you are talking about runs in an XForms page, is that right?

 

If so, are you looking for the id() function as defined in XForms 1.1?

 

http://www.w3.org/TR/xforms11/#fn-id

 

If so, it's not implemented in the XForms engine, as documented here:

 

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-xpath-functions#TOC-Functions-not-yet-implemented

 

XPath 2 has an id() function as well:

 

http://www.w3.org/TR/xpath-functions/#func-id

 

Since we don't implement our own version of id() in the XForms engine, I assume the default implementation of id() in the XPath engine is kicking in. Since the XPath engine is not schema-aware, it won't know about ids you define in your schema.

 

Now as to why some features are not implemented in Orbeon Forms… Steve Jobs famously said recently [1] that Apple has "limited resources" and therefore has to focus on the right stuff. Needless to say Orbeon also has limited resources ;) Everything pretty much flows from that.

 

-Erik

 

[1] http://news.cnet.com/8301-13860_3-20006526-56.html

On Tue, Mar 1, 2011 at 2:57 AM, Stumpf, Jens Thorsten <[hidden email]> wrote:

Sorry,

But I have to push that.

In the end it boils down to a simple question:
Does *any* version of Orbeon support XPath operations on generic xml:id or XSD-specified id with the id()-function in instances or not?

If not: Why?

If yes: What's wrong about the XPath below?

Regards,

JT



> -----Original Message-----
> From: Stumpf, Jens Thorsten
> Sent: Monday, February 28, 2011 7:58 PM
> To: [hidden email]
> Subject: [ops-users] Using XSD-IDREFS/-ID typed elements to identify
> relevant elements
>
> Hi!
>
> We're still using 3.7.1 but my question seems to be a rather general one.
>
> I want to identify and reference one or more elements by their attribute id.
> The id attributes have been declared to be of type id and the attribute ref has
> been declared as IDREFS.
>
> Orbeon obviously doesn't recognize the IDs as IDs and the IDREFS as
> IDREFS.
> See below example for example structure:
>
> <toys xmlns:bar="http://www.foo.com/FooBarML"
> xmlns="http://www.foo.com/FooML"
> xmlns:baz="http://www.foo.com/FooBazML">
>         <request>
>             <id>201114</id>
>             <method>com.foo.product.get</method>
>             <parameter>
>                 <company>toyland</company>
>                 <vid>v1029983</productid>
>             </parameter>
>         </request>
>         <data>
>                 <baz:products>
>                     <baz:product producttype="cartoon" id="p395033">
>                         <baz:title>Malibu Stacy</baz:title>
>                         <baz:variant available="true" id="v1029982">
>                             <baz:title>Sand</baz:title>
>                             <baz:home alternatives="v1029983 v1029984">
>                                 <baz:value>Beachhouse</baz:value>
>                             </baz:arrival>
>                         </baz:variant>
>                         <baz:variant available="true" id="v1029983">
>                             <baz:title>Business</baz:title>
>                             <baz:home alternatives="v1029982 v1029984">
>                                 <baz:value>Penthouse</baz:value>
>                             </baz:arrival>
>                         </baz:variant>
>                         <baz:variant available="true" id="v1029984">
>                             <baz:title>Sport</baz:title>
>                             <baz:home alternatives="v1029982 v1029983">
>                                 <baz:value>Tent</baz:value>
>                             </baz:arrival>
>                         </baz:variant>
> ...
>
> What I want to do is to get all available product variant nodes of the selected
> node (which is here defined by /toys/request/parameter/vid).
> XPath/XSL-T offers a quite good way to do so: using either the function 'id' or
> 'key'.
>
> But key has to be declared whereas id should be available for all nodes having
> a "schema"declared id.
>
>       id(//request/parameter/vid)
>
> should return the 'Business' variant of Malibu Stacy (in production we let the
> user choose the wished product option).
>
> If the user selected any of these product variants we want to offer the different
> other choices of product variants. It should be possible to get all other types
> of home of these variants by querying for
>
>       id(id(//request/parameter/vid)/home/@alternatives)/baz:home
>
> returning a node set like
>
>                             <baz:home alternatives="v1029983 v1029984">
>                                 <baz:value>Beachhouse</baz:value>
>                             </baz:arrival>
>                             <baz:home alternatives="v1029982 v1029983">
>                                 <baz:value>Tent</baz:value>
>                             </baz:arrival>
>
> with the 'home's subtree of the referenced variants.
> I also tried to set an generic XML-ID attribute by xml:id. But it didn't work out
> as well.
>
> Of course this is just an example - the structure of our XML is a bit more
> complex though it is basically the same!
>
> Orbeon returns an empty result set (produced by the XPath function id - or it
> doesn't work at all).
> Can you give me a hint what's wrong?
>
> Thanks,
>
> JT


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws