Login  Register

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

Posted by Thorsten Stumpf on Mar 01, 2011; 10:57am
URL: https://discuss.orbeon.com/Using-XSD-IDREFS-ID-typed-elements-to-identify-relevant-elements-tp3328493p3329620.html

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