Further experiments on that point:

Le vendredi 21 janvier 2005 � 10:30 +0100, Eric van der Vlist a �crit :

> > Eric, inside the above <result page="apiculteur"/> you should use XUpdate
> > to set /form/document-id on the target XForms instance. Then as
> > /form/document-id comes from the URL in the target page, and the XForms
> > instance is otherwise empty, the PFC will generate a nice URL
> > /apiculteurs/apiculteur/your-doc-id/. 
> 
> I can try that, but I had understood that the new instance was the
> output of the action, that's why I had added this:
> 
>     <p:processor name="oxf:identity">
>         <p:input name="data" >
>             <form>
>                 <document-id>foo</document-id>
>                 <action/>
>             </form>
>             </p:input>
>         <p:output name="data" ref="data"/>
>     </p:processor>
> 
> in the action, considering that since I want to replace the whole
> instance by nothing else but
> 
> <form>
>      <document-id>foo</document-id>
>      <action/>
> </form>
> 
> that would be easier like that than using XUpdate.

Right now, it's working exactly as you describe if I write:


      <action
            when="/form/action = 'save' and not(/form/document//[EMAIL 
PROTECTED]:valid = 'false' and not(ancestor-or-self::[EMAIL PROTECTED]:relevant 
= 'false'])]) "
            action="save-new-document.xpl">
            <result page="apiculteur">
                <xu:update select="/form/document-id">
                    <xu:value-of
                        
select="translate(normalize-space(document('oxf:instance')/form/document/rdf:RDF/bk:beekeeper/bk:name),
 ' AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz������������� 
�����������������������������������������������', 
'+aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzaaaaaaaaaaaa� 
�cceeeeeeeeiiiiiiii��nnoooooooooo��uuuuuuuuyy��')"
                    />
                </xu:update>
                <xu:remove select="/form/*[not(self::document-id)]"/>
            </result>
        </action>

The issue with this solution is that I need to duplicate the logic that
computes an ID from the document.

Right now, this is *only* more difficult to maintain (I need to update
this logic at two locations).

And, in the future, I might have to extend this algorithm (for instance
to check for duplicates in the database) and it might even become
impossible to implement with pure XPath.

This ID being already computed in the action, is there a way to pass its
value from the action to the update statement?

Thanks;

Eric

-- 
Carnet web :
           http://eric.van-der-vlist.com/blog?t=category&a=Fran%C3%A7ais
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
orbeon-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/orbeon-user

Reply via email to