XUpdate : can't recuperate info

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

XUpdate : can't recuperate info

StephR
I have been stuck for two hours finding all kinds of mechanisms to do what I want, with no success.

Quite simple, I have a first processor that just recuperates the id of a user

<p:processor name="oxf:xslt">
  <p:input name="data" href="#instance"/>
    <p:input name="config">
        <xdb:query collection="/db/system" xsl:version="2.0">
           <uid>
              {for $user in /auth/users/user
              where $user/@name = '<xsl:value-of select="/form/username"/>'
              return data($user/@uid)}
          </uid>
       </xdb:query>
    </p:input>
  <p:output name="data" id="get_uid"/>
</p:processor>

If I copy-paste my query in exist, the query will work fine : <uid>4</uid>

Then I launch the query of course :

<p:processor name="oxf:xmldb-query">
   <p:input name="datasource" href="#datasource"/>
   <p:input name="query" href="#get_uid"/>
   <p:output name="data" id="user_uid"/>
</p:processor>

I would like now to modify the previous instance with the user id I fetched :

<p:processor name="oxf:xupdate">
   <p:input name="data" href="#instance"/>
        <p:input name="user" href="#user_uid"/>
        <p:input name="config">
            <xu:modifications  xmlns:xu="http://www.xmldb.org/xupdate">
                <xu:update select="/form/uid">
                    <xu:value-of select="doc('input:user')/uid"/>
                </xu:update>
            </xu:modifications>
        </p:input>
   <p:output name="data" id="new_instance"/>
</p:processor>

I have put a widget inspector to check the instance, and the uid stays desperately empty. To test if my update processor was really correct, I did the following :

    <p:processor name="oxf:identity">
        <p:input name="data">
            <uid>4</uid>
        </p:input>
        <p:output name="data" id="user_uid2"/>
    </p:processor>

And I change the input of xupdate from #user_id to #user_id2 and everything work perfectly! Which would mean that my query would be wrong, but how could this be possible : I tested the query directly in eXist and the xmldb-query is the standard query I have been doing for a while !!!

Any hints would be highly appreciated!

Steph



--
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
Reply | Threaded
Open this post in threaded view
|

Re: XUpdate : can't recuperate info

fl.schmitt
Hi Stephane,

> <p:processor name="oxf:xslt">
>   <p:input name="data" href="#instance"/>
>     <p:input name="config">
>         <xdb:query collection="/db/system" xsl:version="2.0">
>            <uid>
>               {for $user in /auth/users/user
>               where $user/@name = '<xsl:value-of select="/form/username"/>'
>               return data($user/@uid)}
>           </uid>
>        </xdb:query>
>     </p:input>
>   <p:output name="data" id="get_uid"/>
> </p:processor>
i would recommend to add a debug attribute to the output of this processor (and,
maybe, to the instance input). So you're able to check how the query looks like
in real that's passed to the xmldb-query processor. For my part, i put debug
attributes in almost every in- and ouput in a newly created XPL to check what
processors are called and with which instance they're called. Often, i'm quite
surprised of the output my processors are creating when testing a new XPL ;-) .

HTH
florian


--
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