xsltforms-support Mailing List for XSLTForms (Page 7)
Brought to you by:
alain-couthures
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(6) |
Jun
(9) |
Jul
(16) |
Aug
(5) |
Sep
(43) |
Oct
(36) |
Nov
(58) |
Dec
(43) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(79) |
Feb
(81) |
Mar
(107) |
Apr
(93) |
May
(85) |
Jun
(54) |
Jul
(64) |
Aug
(54) |
Sep
(45) |
Oct
(53) |
Nov
(34) |
Dec
(77) |
2011 |
Jan
(56) |
Feb
(53) |
Mar
(52) |
Apr
(66) |
May
(44) |
Jun
(16) |
Jul
(28) |
Aug
(5) |
Sep
(15) |
Oct
(21) |
Nov
(51) |
Dec
(46) |
2012 |
Jan
(16) |
Feb
(38) |
Mar
(47) |
Apr
(45) |
May
(41) |
Jun
(41) |
Jul
(72) |
Aug
(17) |
Sep
(10) |
Oct
(16) |
Nov
(29) |
Dec
(30) |
2013 |
Jan
(25) |
Feb
(13) |
Mar
(20) |
Apr
(25) |
May
(34) |
Jun
(8) |
Jul
(12) |
Aug
(9) |
Sep
(21) |
Oct
(19) |
Nov
(6) |
Dec
(2) |
2014 |
Jan
(14) |
Feb
(8) |
Mar
(7) |
Apr
(13) |
May
(33) |
Jun
(13) |
Jul
(6) |
Aug
(5) |
Sep
(5) |
Oct
(34) |
Nov
(7) |
Dec
|
2015 |
Jan
(1) |
Feb
(6) |
Mar
(17) |
Apr
(12) |
May
(10) |
Jun
(18) |
Jul
(31) |
Aug
(9) |
Sep
(3) |
Oct
(6) |
Nov
(19) |
Dec
(1) |
2016 |
Jan
(18) |
Feb
(4) |
Mar
(13) |
Apr
(19) |
May
|
Jun
(17) |
Jul
(7) |
Aug
|
Sep
(3) |
Oct
(6) |
Nov
(3) |
Dec
|
2017 |
Jan
(5) |
Feb
(17) |
Mar
(4) |
Apr
(8) |
May
(3) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
|
Oct
(5) |
Nov
(6) |
Dec
(4) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
(1) |
2019 |
Jan
|
Feb
|
Mar
(4) |
Apr
(2) |
May
(4) |
Jun
|
Jul
|
Aug
(2) |
Sep
(7) |
Oct
|
Nov
|
Dec
|
2020 |
Jan
(13) |
Feb
(17) |
Mar
(8) |
Apr
(11) |
May
(15) |
Jun
(11) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
2021 |
Jan
(9) |
Feb
(26) |
Mar
(17) |
Apr
|
May
(7) |
Jun
(18) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(10) |
2022 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(2) |
Sep
(3) |
Oct
(2) |
Nov
(10) |
Dec
(1) |
2023 |
Jan
(10) |
Feb
|
Mar
(7) |
Apr
(8) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(8) |
Oct
(11) |
Nov
(8) |
Dec
(5) |
2024 |
Jan
(7) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(4) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Alessandro <ca...@tu...> - 2021-02-22 16:57:32
|
Hi all! How to implement through xquery and xpath a relational logic one-to-multiple? I'd like to have an xml file containing the list of all the safety courses attended by our employees, which then could be referenced only by rows ids. In this way it would be just a question of including within every employee's personal data only the id numbers corresponding to the courses effectively attended by each one of them, finally loading for each employee the courses within a repeat by means of the courses ids... Thanks Alex-- Sent with Tutanota, the secure & ad-free mailbox: https://tutanota.com |
From: Josselin M. <mor...@gm...> - 2021-02-14 11:23:30
|
Hi Alain, My apologies, I tried your solution quickly yesterday afternoon when I saw your answer, but I didn’t think to empty my browser's cache. It works perfectly now, thank you very much for your advices with Steven, it helped me a lot! Best, Josselin. > Le 14 févr. 2021 à 09:30, Alain Couthures <ala...@ag...> a écrit : > > Hi Josselin, > > It works for me with XSLTForms 1.5.2. Next major XSLTForms release (1.6?) is not yet released (it is using a new XPath 3.0 engine which is transpiling expressions into Javascript functions...). > > Could you please try again with an empty browser cache? > > Thanks! > > --Alain >> Le 13/02/2021 21:45, Josselin Morvan <mor...@gm...> a écrit : >> >> >> Hi Alain, >> >> Thank you very much for your feedback. I tried what you suggest, unfortunately, if it works perfectly with XSLTForms 1.3, it doesn’t with XSLTForms 1.5.3, the last submission is still activated twice with this release. >> >> Thanks for your help, >> Best, >> Josselin. >> >>> Le 13 févr. 2021 à 17:51, Alain Couthures <ala...@ag... <mailto:ala...@ag...>> a écrit : >>> Hi Josselin, >>> >>> In this test case, an event is defined so two submissions are to be sent synchronously, one after one, according to a condition which should be true for one only. The first one will send again the same event producing a submission loop effect. But the first one is also altering the loop condition and it appears that, at the end, the 2 submissions are sent for the same event just before the latest event being caught. >>> >>> The easiest way to control this is to invert the order of the submissions: the one to be activated at the end is to be tested before the one to be activated repeatedly. >>> >>> <xf:action ev:event="submission"> >>> <xf:send if="not(instance('sub')/xpr:person[@localType='new'])" submission="submitBio"/> >>> <xf:send if="instance('sub')/xpr:person[@localType='new']" submission="submitNewPerson"/> >>> </xf:action> >>> >>> Thank you for your feedback! >>> >>> --Alain >>>> Le 06/02/2021 14:42, Josselin Morvan <mor...@gm... <mailto:mor...@gm...>> a écrit : >>>> >>>> >>>> Hi Steven, Hi Alain, >>>> >>>> I made a short and simple sample to show you how my form works, what it does, and the error I get with the submission. >>>> >>>> Because I run it with BaseX, I added a little Xquery script that creates the db and allows the saving of the submissions. >>>> If you want to use it, just put the form file into basex/webapp/static folder and the Xquery file into basex/webapp/ folder. It is a little REST application, just run basexhttp, then go to http://localhost:8984/xforms/install <http://localhost:8984/xforms/install> to create the db, and to http://localhost:8984/static/xsltforms/submissionLoop.xml <http://localhost:8984/static/xsltforms/submissionLoop.xml> to access the form. >>>> >>>> You can access the files on my Github Gist : https://gist.github.com/sardinecan/64451cf122095178159804e1ea13b4e5 <https://gist.github.com/sardinecan/64451cf122095178159804e1ea13b4e5> >>>> >>>> As you’ll see, I have two submissions, one for the added persons, which is looping as long as there are new persons, and a second one for the main instance which is running when all the new persons have been submitted. >>>> >>>> I use the dispatch method, with the xforms-submit-done event, and a @delay : >>>> >>>> <xf:action ev:event="xforms-submit-done"> >>>> <xf:dispatch name="submission" targetid="model" delay="1"/> >>>> </xf:action> >>>> >>>> Then I have a "if" rule to select the submission to run : >>>> >>>> <xf:action ev:event="submission"> >>>> <xf:send if="instance('sub')/xpr:person[@localType='new']" submission="submitNewPerson"/> >>>> <xf:send if="not(instance('sub')/xpr:person[@localType='new'])" submission="submitBio"/> >>>> </xf:action> >>>> >>>> Like Steven suggests, I think now that there is a submission activated twice, as the submission#submitBio is running two time and it shouldn’t, but maybe I’m doing something wrong ? >>>> >>>> Thanks a lot for your help, >>>> Best, >>>> Josselin. >>>> >>>> >>>>> Le 5 févr. 2021 à 10:54, Steven Pemberton <ste...@cw... <mailto:ste...@cw...>> a écrit : >>>>> Although submissions are by default asynchronous, a submission element may only be activated once at a time. I'm surprised that all the event values are empty; they really shouldn't be for an xforms-submit-error event. >>>>> >>>>> There is a difference in semantics between a dispatch with and without a delay, even if the delay is 0, so try making the delay 0, it should still work. The fact that it works with my original dispatch method suggests that the problem is indeed with a submission being activated twice, but my reading of the spec is that it should be possible once submit-done has been dispatched. I will raise this with the working group. >>>>> >>>>> Best wishes, >>>>> >>>>> Steven >>>>> >>>>> On Thursday 04 February 2021 23:42:37 (+01:00), Josselin Morvan wrote: >>>>> >>>>> Hi Steven, >>>>> >>>>> Thank you for your quick response. Unfortunately, all the error events are empty. >>>>> So, I tried your method with the dispatch element. At first it didn’t work either, then I added a delay to the dispatch and… it works! >>>>> As I said, when the submission is done, I update my instance with the server’s response (@xml:id and @localType value, etc.) and then I perform the next submission, maybe all these actions are asynchronous or performed simultaneously, and it produces a conflict? The @delay would allow to really execute the next submission at the end of the entire process? >>>>> >>>>> Best, >>>>> Josselin. >>>>> >>>>>> Le 4 févr. 2021 à 22:25, Steven Pemberton <ste...@cw... <mailto:ste...@cw...>> a écrit : >>>>>> <message>Submission error. error-type: <output value="event('error-type')"/> error-message: <output value="event('error-message')"/> response-status-code: <output value="event('response-status-code')"/> response-reason-phrase: <output value="event('response-reason-phrase')"/> resource-uri: <output value="event('resource-uri')"/> </message> >>>>> >>>>> >>>>> -- >>>> >>>> _______________________________________________ Xsltforms-support mailing list Xsl...@li... <mailto:Xsl...@li...> https://lists.sourceforge.net/lists/listinfo/xsltforms-support <https://lists.sourceforge.net/lists/listinfo/xsltforms-support> > <Screenshot 2021-02-14 091849.png><Screenshot 2021-02-14 091812.png> |
From: Alain C. <ala...@ag...> - 2021-02-14 08:31:18
|
<!doctype html> <html> <head> <meta charset="UTF-8"> </head> <body> <div> Hi Josselin, </div> <div class="default-style"> <br> </div> <div class="default-style"> It works for me with XSLTForms 1.5.2. Next major XSLTForms release (1.6?) is not yet released (it is using a new XPath 3.0 engine which is transpiling expressions into Javascript functions...). </div> <div class="default-style"> <br> </div> <div class="default-style"> Could you please try again with an empty browser cache? </div> <div class="default-style"> <br> </div> <div class="default-style"> Thanks! </div> <div class="default-style"> <br> </div> <div class="default-style"> --Alain </div> <blockquote type="cite"> <div> Le 13/02/2021 21:45, Josselin Morvan <mor...@gm...> a écrit : </div> <div> <br> </div> <div> <br> </div>Hi Alain, <div class=""> <br class=""> </div> <div class=""> Thank you very much for your feedback. I tried what you suggest, unfortunately, if it works perfectly with XSLTForms 1.3, it doesn’t with XSLTForms 1.5.3, the last submission is still activated twice with this release. </div> <div class=""> <br class=""> </div> <div class=""> Thanks for your help, </div> <div class=""> Best, </div> <div class=""> Josselin. <br class=""> <div> <br class=""> <blockquote type="cite"> <div class=""> Le 13 févr. 2021 à 17:51, Alain Couthures <<a class="" href="mailto:ala...@ag...">ala...@ag...</a>> a écrit : </div> <div class=""> <div class=""> <div class=""> Hi Josselin, </div> <div class="default-style"> <br class=""> </div> <div class="default-style"> In this test case, an event is defined so two submissions are to be sent synchronously, one after one, according to a condition which should be true for one only. The first one will send again the same event producing a submission loop effect. But the first one is also altering the loop condition and it appears that, at the end, the 2 submissions are sent for the same event just before the latest event being caught. </div> <div class="default-style"> <br class=""> </div> <div class="default-style"> The easiest way to control this is to invert the order of the submissions: the one to be activated at the end is to be tested <span class="" style="text-decoration: underline;">before</span> the one to be activated repeatedly. </div> <div class="default-style"> <br class=""> </div> <div class="default-style"> <div class=""> <xf:action ev:event="submission"> </div> <div class=""> <xf:send if="not(instance('sub')/xpr:person[@localType='new'])" submission="submitBio"/> </div> <div class=""> <xf:send if="instance('sub')/xpr:person[@localType='new']" submission="submitNewPerson"/> </div> <div class=""> </xf:action> </div> <div class=""> <br class=""> </div> </div> <div class="default-style"> Thank you for your feedback! </div> <div class="default-style"> <br class=""> </div> <div class="default-style"> --Alain </div> <blockquote type="cite"> <div class=""> Le 06/02/2021 14:42, Josselin Morvan <<a class="" href="mailto:mor...@gm...">mor...@gm...</a>> a écrit : </div> <div class=""> <br class=""> </div> <div class=""> <br class=""> </div> <div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""> Hi Steven, Hi Alain, <div class=""> <br class=""> </div> <div class=""> I made a short and simple sample to show you how my form works, what it does, and the error I get with the submission. </div> <div class=""> <br class=""> </div> <div class=""> Because I run it with BaseX, I added a little Xquery script that creates the db and allows the saving of the submissions. </div> <div class=""> If you want to use it, just put the form file into basex/webapp/static folder and the Xquery file into basex/webapp/ folder. It is a little REST application, just run basexhttp, then go to <a href="http://localhost:8984/xforms/install" class="">http://localhost:8984/xforms/install</a> to create the db, and to <a href="http://localhost:8984/static/xsltforms/submissionLoop.xml" class="">http://localhost:8984/static/xsltforms/submissionLoop.xml</a> to access the form. </div> <div class=""> <br class=""> </div> <div class=""> You can access the files on my Github Gist : <a href="https://gist.github.com/sardinecan/64451cf122095178159804e1ea13b4e5" class="">https://gist.github.com/sardinecan/64451cf122095178159804e1ea13b4e5</a> </div> <div class=""> <br class=""> </div> <div class=""> As you’ll see, I have two submissions, one for the added persons, which is looping as long as there are new persons, and a second one for the main instance which is running when all the new persons have been submitted. </div> <div class=""> <br class=""> </div> <div class=""> I use the dispatch method, with the xforms-submit-done event, and a @delay : </div> <div class=""> <br class=""> </div> <div class=""> <div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: #3c3c3c;" class=""> <span style="color: #5fc8fd;" class=""><xf:action</span><span style="color: #ff8d54;" class=""> ev:event</span><span style="color: #ff8040;" class="">=</span><span style="color: #e06a53;" class="">"xforms-submit-done"</span><span style="color: #5fc8fd;" class="">></span><span class=""><br class=""></span><span style="color: #e5e5e5;" class=""><span style="caret-color: #e5e5e5;" class=""> </span></span><span style="color: #5fc8fd;" class=""><xf:dispatch</span><span style="color: #ff8d54;" class=""> name</span><span style="color: #ff8040;" class="">=</span><span style="color: #e06a53;" class="">"submission"</span><span style="color: #ff8d54;" class=""> targetid</span><span style="color: #ff8040;" class="">=</span><span style="color: #e06a53;" class="">"model"</span><span style="color: #ff8d54;" class=""> delay</span><span style="color: #ff8040;" class="">=</span><span style="color: #e06a53;" class="">"1"</span><span style="color: #5fc8fd;" class="">/></span><span class=""><br class=""></span><span style="color: #5fc8fd;" class=""></xf:action></span> </div> </div> <div class=""> <span style="color: #5fc8fd;" class=""><br class=""></span> </div> <div class=""> Then I have a "if" rule to select the submission to run : </div> <div class=""> <br class=""> </div> <div class=""> <div style="margin: 0px; font-stretch: normal; line-height: normal; color: #e06a53; background-color: #3c3c3c;" class=""> <span style="color: #5fc8fd;" class=""><xf:action</span><span style="color: #ff8d54;" class=""> ev:event</span><span style="color: #ff8040;" class="">=</span>"submission"<span style="color: #5fc8fd;" class="">></span><span class=""><br class=""></span><span style="color: #e5e5e5;" class=""> </span><span style="color: #5fc8fd;" class=""><xf:send</span><span style="color: #ff8d54;" class=""> if</span><span style="color: #ff8040;" class="">=</span>"instance('sub')/xpr:person[@localType='new']"<span style="color: #ff8d54;" class=""> submission</span><span style="color: #ff8040;" class="">=</span>"submitNewPerson"<span style="color: #5fc8fd;" class="">/></span><span class=""><br class=""></span><span style="color: #e5e5e5;" class=""> </span><span style="color: #5fc8fd;" class=""><xf:send</span><span style="color: #ff8d54;" class=""> if</span><span style="color: #ff8040;" class="">=</span>"not(instance('sub')/xpr:person[@localType='new'])"<span style="color: #ff8d54;" class=""> submission</span><span style="color: #ff8040;" class="">=</span>"submitBio"<span style="color: #5fc8fd;" class="">/></span><span class=""><br class=""></span><span style="color: #e5e5e5;" class=""> </span><span style="color: #5fc8fd;" class=""></xf:action></span> </div> </div> <div class=""> <span style="color: #5fc8fd;" class=""><br class=""></span> </div> <div class=""> Like Steven suggests, I think now that there is a submission activated twice, as the submission#submitBio is running two time and it shouldn’t, but maybe I’m doing something wrong ? </div> <div class=""> <br class=""> </div> <div class=""> Thanks a lot for your help, </div> <div class=""> Best, </div> <div class=""> Josselin. </div> <div class=""> <br class=""> <div class=""> <br class=""> <blockquote type="cite"> <div class=""> Le 5 févr. 2021 à 10:54, Steven Pemberton <<a href="mailto:ste...@cw..." class="">ste...@cw...</a>> a écrit : </div> <div class=""> <div class=""> Although submissions are by default asynchronous, a submission element may only be activated once at a time. I'm surprised that all the event values are empty; they really shouldn't be for an xforms-submit-error event. <div class=""> <br class=""> </div> <div class=""> There is a difference in semantics between a dispatch with and without a delay, even if the delay is 0, so try making the delay 0, it should still work. The fact that it works with my original dispatch method suggests that the problem is indeed with a submission being activated twice, but my reading of the spec is that it should be possible once submit-done has been dispatched. I will raise this with the working group. </div> <div class=""> <br class=""> </div> <div class=""> Best wishes, </div> <div class=""> <br class=""> </div> <div class=""> Steven <br class=""> <br class="">On Thursday 04 February 2021 23:42:37 (+01:00), Josselin Morvan wrote: <br class=""> <br class=""> <blockquote> Hi Steven, <div class=""> <br class=""> </div> <div class=""> Thank you for your quick response. Unfortunately, all the error events are empty. </div> <div class=""> So, I tried your method with the dispatch element. At first it didn’t work either, then I added a delay to the dispatch and… it works! </div> <div class=""> <div class=""> As I said, when the submission is done, I update my instance with the server’s response (@xml:id and @localType value, etc.) and then I perform the next submission, maybe all these actions are asynchronous or performed simultaneously, and it produces a conflict? The @delay would allow to really execute the next submission at the end of the entire process? </div> <div class=""> <br class=""> </div> <div class=""> Best, </div> <div class=""> Josselin. </div> <div class=""> <br class=""> <blockquote type="cite"> <div class=""> Le 4 févr. 2021 à 22:25, Steven Pemberton <<a href="mailto:ste...@cw..." class="">ste...@cw...</a>> a écrit : </div> <div class=""> <span style="display: inline; float: none; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-decoration-line: none; -webkit-text-stroke-width: 0px; word-spacing: 0px; white-space: pre; text-transform: none; text-indent: 0px; text-align: start; letter-spacing: normal; font-weight: normal; font-variant-caps: normal; font-style: normal; font-size: inherit; font-family: monospace; color: #0000ff; caret-color: #0000ff;" class=""><message>Submission error. error-type: <output value="event('error-type')"/> error-message: <output value="event('error-message')"/> response-status-code: <output value="event('response-status-code')"/> response-reason-phrase: <output value="event('response-reason-phrase')"/> resource-uri: <output value="event('resource-uri')"/> </message></span> </div> </blockquote> </div> <br class=""> </div> </blockquote> <br class="">-- <br class=""> </div> </div> </div> </blockquote> </div> <br class=""> </div> </div>_______________________________________________ Xsltforms-support mailing list <a class="" href="mailto:Xsl...@li...">Xsl...@li...</a> <a class="" href="https://lists.sourceforge.net/lists/listinfo/xsltforms-support">https://lists.sourceforge.net/lists/listinfo/xsltforms-support</a> </blockquote> </div> </div> </blockquote> </div> <br class=""> </div> </blockquote> </body> </html> |
From: Josselin M. <mor...@gm...> - 2021-02-13 20:45:30
|
Hi Alain, Thank you very much for your feedback. I tried what you suggest, unfortunately, if it works perfectly with XSLTForms 1.3, it doesn’t with XSLTForms 1.5.3, the last submission is still activated twice with this release. Thanks for your help, Best, Josselin. > Le 13 févr. 2021 à 17:51, Alain Couthures <ala...@ag...> a écrit : > > Hi Josselin, > > In this test case, an event is defined so two submissions are to be sent synchronously, one after one, according to a condition which should be true for one only. The first one will send again the same event producing a submission loop effect. But the first one is also altering the loop condition and it appears that, at the end, the 2 submissions are sent for the same event just before the latest event being caught. > > The easiest way to control this is to invert the order of the submissions: the one to be activated at the end is to be tested before the one to be activated repeatedly. > > <xf:action ev:event="submission"> > <xf:send if="not(instance('sub')/xpr:person[@localType='new'])" submission="submitBio"/> > <xf:send if="instance('sub')/xpr:person[@localType='new']" submission="submitNewPerson"/> > </xf:action> > > Thank you for your feedback! > > --Alain >> Le 06/02/2021 14:42, Josselin Morvan <mor...@gm...> a écrit : >> >> >> Hi Steven, Hi Alain, >> >> I made a short and simple sample to show you how my form works, what it does, and the error I get with the submission. >> >> Because I run it with BaseX, I added a little Xquery script that creates the db and allows the saving of the submissions. >> If you want to use it, just put the form file into basex/webapp/static folder and the Xquery file into basex/webapp/ folder. It is a little REST application, just run basexhttp, then go to http://localhost:8984/xforms/install <http://localhost:8984/xforms/install> to create the db, and to http://localhost:8984/static/xsltforms/submissionLoop.xml <http://localhost:8984/static/xsltforms/submissionLoop.xml> to access the form. >> >> You can access the files on my Github Gist : https://gist.github.com/sardinecan/64451cf122095178159804e1ea13b4e5 <https://gist.github.com/sardinecan/64451cf122095178159804e1ea13b4e5> >> >> As you’ll see, I have two submissions, one for the added persons, which is looping as long as there are new persons, and a second one for the main instance which is running when all the new persons have been submitted. >> >> I use the dispatch method, with the xforms-submit-done event, and a @delay : >> >> <xf:action ev:event="xforms-submit-done"> >> <xf:dispatch name="submission" targetid="model" delay="1"/> >> </xf:action> >> >> Then I have a "if" rule to select the submission to run : >> >> <xf:action ev:event="submission"> >> <xf:send if="instance('sub')/xpr:person[@localType='new']" submission="submitNewPerson"/> >> <xf:send if="not(instance('sub')/xpr:person[@localType='new'])" submission="submitBio"/> >> </xf:action> >> >> Like Steven suggests, I think now that there is a submission activated twice, as the submission#submitBio is running two time and it shouldn’t, but maybe I’m doing something wrong ? >> >> Thanks a lot for your help, >> Best, >> Josselin. >> >> >>> Le 5 févr. 2021 à 10:54, Steven Pemberton <ste...@cw... <mailto:ste...@cw...>> a écrit : >>> Although submissions are by default asynchronous, a submission element may only be activated once at a time. I'm surprised that all the event values are empty; they really shouldn't be for an xforms-submit-error event. >>> >>> There is a difference in semantics between a dispatch with and without a delay, even if the delay is 0, so try making the delay 0, it should still work. The fact that it works with my original dispatch method suggests that the problem is indeed with a submission being activated twice, but my reading of the spec is that it should be possible once submit-done has been dispatched. I will raise this with the working group. >>> >>> Best wishes, >>> >>> Steven >>> >>> On Thursday 04 February 2021 23:42:37 (+01:00), Josselin Morvan wrote: >>> >>> Hi Steven, >>> >>> Thank you for your quick response. Unfortunately, all the error events are empty. >>> So, I tried your method with the dispatch element. At first it didn’t work either, then I added a delay to the dispatch and… it works! >>> As I said, when the submission is done, I update my instance with the server’s response (@xml:id and @localType value, etc.) and then I perform the next submission, maybe all these actions are asynchronous or performed simultaneously, and it produces a conflict? The @delay would allow to really execute the next submission at the end of the entire process? >>> >>> Best, >>> Josselin. >>> >>>> Le 4 févr. 2021 à 22:25, Steven Pemberton <ste...@cw... <mailto:ste...@cw...>> a écrit : >>>> <message>Submission error. error-type: <output value="event('error-type')"/> error-message: <output value="event('error-message')"/> response-status-code: <output value="event('response-status-code')"/> response-reason-phrase: <output value="event('response-reason-phrase')"/> resource-uri: <output value="event('resource-uri')"/> </message> >>> >>> >>> -- >> >> _______________________________________________ Xsltforms-support mailing list Xsl...@li... https://lists.sourceforge.net/lists/listinfo/xsltforms-support |
From: Alain C. <ala...@ag...> - 2021-02-13 16:52:16
|
<!doctype html> <html> <head> <meta charset="UTF-8"> </head> <body> <div> Hi Josselin, </div> <div class="default-style"> <br> </div> <div class="default-style"> In this test case, an event is defined so two submissions are to be sent synchronously, one after one, according to a condition which should be true for one only. The first one will send again the same event producing a submission loop effect. But the first one is also altering the loop condition and it appears that, at the end, the 2 submissions are sent for the same event just before the latest event being caught. </div> <div class="default-style"> <br> </div> <div class="default-style"> The easiest way to control this is to invert the order of the submissions: the one to be activated at the end is to be tested <span style="text-decoration: underline;">before</span> the one to be activated repeatedly. </div> <div class="default-style"> <br> </div> <div class="default-style"> <div> <xf:action ev:event="submission"> </div> <div> <xf:send if="not(instance('sub')/xpr:person[@localType='new'])" submission="submitBio"/> </div> <div> <xf:send if="instance('sub')/xpr:person[@localType='new']" submission="submitNewPerson"/> </div> <div> </xf:action> </div> <div> <br> </div> </div> <div class="default-style"> Thank you for your feedback! </div> <div class="default-style"> <br> </div> <div class="default-style"> --Alain </div> <blockquote type="cite"> <div> Le 06/02/2021 14:42, Josselin Morvan <mor...@gm...> a écrit : </div> <div> <br> </div> <div> <br> </div> <div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" dir="auto"> Hi Steven, Hi Alain, <div class=""> <br class=""> </div> <div class=""> I made a short and simple sample to show you how my form works, what it does, and the error I get with the submission. </div> <div class=""> <br class=""> </div> <div class=""> Because I run it with BaseX, I added a little Xquery script that creates the db and allows the saving of the submissions. </div> <div class=""> If you want to use it, just put the form file into basex/webapp/static folder and the Xquery file into basex/webapp/ folder. It is a little REST application, just run basexhttp, then go to <a class="" href="http://localhost:8984/xforms/install">http://localhost:8984/xforms/install</a> to create the db, and to <a class="" href="http://localhost:8984/static/xsltforms/submissionLoop.xml">http://localhost:8984/static/xsltforms/submissionLoop.xml</a> to access the form. </div> <div class=""> <br class=""> </div> <div class=""> You can access the files on my Github Gist : <a class="" href="https://gist.github.com/sardinecan/64451cf122095178159804e1ea13b4e5">https://gist.github.com/sardinecan/64451cf122095178159804e1ea13b4e5</a> </div> <div class=""> <br class=""> </div> <div class=""> As you’ll see, I have two submissions, one for the added persons, which is looping as long as there are new persons, and a second one for the main instance which is running when all the new persons have been submitted. </div> <div class=""> <br class=""> </div> <div class=""> I use the dispatch method, with the xforms-submit-done event, and a @delay : </div> <div class=""> <br class=""> </div> <div class=""> <div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: #3c3c3c;"> <span class="" style="color: #5fc8fd;"><xf:action</span><span class="" style="color: #ff8d54;"> ev:event</span><span class="" style="color: #ff8040;">=</span><span class="" style="color: #e06a53;">"xforms-submit-done"</span><span class="" style="color: #5fc8fd;">></span><span class="" style="color: #000000;"><br class=""></span><span class="" style="color: #e5e5e5;"><span class="" style="caret-color: #e5e5e5;"> </span></span><span class="" style="color: #5fc8fd;"><xf:dispatch</span><span class="" style="color: #ff8d54;"> name</span><span class="" style="color: #ff8040;">=</span><span class="" style="color: #e06a53;">"submission"</span><span class="" style="color: #ff8d54;"> targetid</span><span class="" style="color: #ff8040;">=</span><span class="" style="color: #e06a53;">"model"</span><span class="" style="color: #ff8d54;"> delay</span><span class="" style="color: #ff8040;">=</span><span class="" style="color: #e06a53;">"1"</span><span class="" style="color: #5fc8fd;">/></span><span class="" style="color: #000000;"><br class=""></span><span class="" style="color: #5fc8fd;"></xf:action></span> </div> </div> <div class=""> <span class="" style="color: #5fc8fd;"><br class=""></span> </div> <div class=""> Then I have a "if" rule to select the submission to run : </div> <div class=""> <br class=""> </div> <div class=""> <div class="" style="margin: 0px; font-stretch: normal; line-height: normal; color: #e06a53; background-color: #3c3c3c;"> <span class="" style="color: #5fc8fd;"><xf:action</span><span class="" style="color: #ff8d54;"> ev:event</span><span class="" style="color: #ff8040;">=</span>"submission"<span class="" style="color: #5fc8fd;">></span><span class="" style="color: #000000;"><br class=""></span><span class="" style="color: #e5e5e5;"> </span><span class="" style="color: #5fc8fd;"><xf:send</span><span class="" style="color: #ff8d54;"> if</span><span class="" style="color: #ff8040;">=</span>"instance('sub')/xpr:person[@localType='new']"<span class="" style="color: #ff8d54;"> submission</span><span class="" style="color: #ff8040;">=</span>"submitNewPerson"<span class="" style="color: #5fc8fd;">/></span><span class="" style="color: #000000;"><br class=""></span><span class="" style="color: #e5e5e5;"> </span><span class="" style="color: #5fc8fd;"><xf:send</span><span class="" style="color: #ff8d54;"> if</span><span class="" style="color: #ff8040;">=</span>"not(instance('sub')/xpr:person[@localType='new'])"<span class="" style="color: #ff8d54;"> submission</span><span class="" style="color: #ff8040;">=</span>"submitBio"<span class="" style="color: #5fc8fd;">/></span><span class="" style="color: #000000;"><br class=""></span><span class="" style="color: #e5e5e5;"> </span><span class="" style="color: #5fc8fd;"></xf:action></span> </div> </div> <div class=""> <span class="" style="color: #5fc8fd;"><br class=""></span> </div> <div class=""> Like Steven suggests, I think now that there is a submission activated twice, as the submission#submitBio is running two time and it shouldn’t, but maybe I’m doing something wrong ? </div> <div class=""> <br class=""> </div> <div class=""> Thanks a lot for your help, </div> <div class=""> Best, </div> <div class=""> Josselin. </div> <div class=""> <br class=""> <div> <br class=""> <blockquote type="cite"> <div class=""> Le 5 févr. 2021 à 10:54, Steven Pemberton <<a class="" href="mailto:ste...@cw...">ste...@cw...</a>> a écrit : </div> <div class=""> <div class=""> Although submissions are by default asynchronous, a submission element may only be activated once at a time. I'm surprised that all the event values are empty; they really shouldn't be for an xforms-submit-error event. <div class=""> <br class=""> </div> <div class=""> There is a difference in semantics between a dispatch with and without a delay, even if the delay is 0, so try making the delay 0, it should still work. The fact that it works with my original dispatch method suggests that the problem is indeed with a submission being activated twice, but my reading of the spec is that it should be possible once submit-done has been dispatched. I will raise this with the working group. </div> <div class=""> <br class=""> </div> <div class=""> Best wishes, </div> <div class=""> <br class=""> </div> <div class=""> Steven <br class=""> <br class="">On Thursday 04 February 2021 23:42:37 (+01:00), Josselin Morvan wrote: <br class=""> <br class=""> <blockquote> Hi Steven, <div class=""> <br class=""> </div> <div class=""> Thank you for your quick response. Unfortunately, all the error events are empty. </div> <div class=""> So, I tried your method with the dispatch element. At first it didn’t work either, then I added a delay to the dispatch and… it works! </div> <div class=""> <div class=""> As I said, when the submission is done, I update my instance with the server’s response (@xml:id and @localType value, etc.) and then I perform the next submission, maybe all these actions are asynchronous or performed simultaneously, and it produces a conflict? The @delay would allow to really execute the next submission at the end of the entire process? </div> <div class=""> <br class=""> </div> <div class=""> Best, </div> <div class=""> Josselin. </div> <div class=""> <br class=""> <blockquote type="cite"> <div class=""> Le 4 févr. 2021 à 22:25, Steven Pemberton <<a class="" href="mailto:ste...@cw...">ste...@cw...</a>> a écrit : </div> <div class=""> <span class="" style="display: inline; float: none; text-decoration-color: initial; text-decoration-style: initial; text-decoration-thickness: initial; text-decoration-line: none; -webkit-text-stroke-width: 0px; word-spacing: 0px; white-space: pre; text-transform: none; text-indent: 0px; text-align: start; letter-spacing: normal; font-weight: normal; font-variant-caps: normal; font-style: normal; font-size: inherit; font-family: monospace; color: #0000ff; caret-color: #0000ff;"><message>Submission error. error-type: <output value="event('error-type')"/> error-message: <output value="event('error-message')"/> response-status-code: <output value="event('response-status-code')"/> response-reason-phrase: <output value="event('response-reason-phrase')"/> resource-uri: <output value="event('resource-uri')"/> </message></span> </div> </blockquote> </div> <br class=""> </div> </blockquote> <br class="">-- <br class=""> </div> </div> </div> </blockquote> </div> <br class=""> </div> </div>_______________________________________________ Xsltforms-support mailing list Xsl...@li... https://lists.sourceforge.net/lists/listinfo/xsltforms-support </blockquote> </body> </html> |
From: Ralph C. <ra...@ra...> - 2021-02-11 21:59:04
|
Many thanks, Josselin. You've helped me more in 24 hours, than weeks of online tutorials! Ralph On 11/02/2021 21:47, Josselin Morvan wrote: > Hi Ralph, > > For the xf: and non-xf: elements, it depends how and where you declare the xforms namespace. > With your form you declared the namespace with the prefix xf: on the html tag : xmlns:xf="http://www.w3.org/2002/xforms", so, as you noticed, you need to use this xf prefix with the xforms elements. > Best, > Josselin > > Envoyé de mon iPhone > >> Le 11 févr. 2021 à 21:31, Ralph Corrigan <ra...@ra...> a écrit : > > Thanks Josselin, clear explanations as ever! > I tried those changes but initially didn't get anywhere. Certainly the context was wrong in the first <repeat>, but it turns out that - in my instance at least - I needed to mark the <insert> as <xf:insert> - it then worked just as expected, so (sorry, I didn't do the verbose although your explanation was extremely helpful): > > <xf:trigger> > <xf:label>New role</xf:label> > <xf:insert nodeset="instance('template')/listPerson/person/occupation" at="index('repeat-occ')" > position="after" ev:event="DOMActivate" /> > </xf:trigger> > > I'm a bit confused by this as the examples in the implementation file have a mix of xf: and non-xf: and work fine, but my xml seems to need every element marked 'xf:'. > > Anyway, many thanks - and hopefully I'll leave you in peace for a while now! > > Ralph > > On 11/02/2021 18:52, Josselin Morvan wrote: > > Hi Ralph, > > As you specified a xf:group/@ref, everything inside this group starts from that point (you keep the context) > > You can try this - the node you want to repeat is your context node ('.' With Xpath ) : > > <xf:group id="pers" ref="instance('template')/listPerson/person"> > <label>So this bit now works!</label> > <xf:repeat id="repeat" nodeset="."> > [...] > </xf:repeat> > [...] > </xf:group> > > Or - you change your xf:group/@ref for the parent node listPerson, and you repeat the child node person : > > <xf:group id="pers" ref="instance('template')/listPerson"> > <label>So this bit now works!</label> > <xf:repeat id="repeat" nodeset="person"> > > [...] > </xf:repeat> > [...] > </xf:group> > > Same idea for the repeat of occupation, as you already start from the node person, you just need to write : @nodeset='occupation' > > For the repeat, I think, at the beginning, you should be verbose to understand how it works : > > <insert context="." > origin="instance('template')/listPerson/person/occupation" > nodeset="occupation" > at="index('repeat-occ')" > position="after" > ev:event="DOMActivate" /> > > To simplify, @context = your evaluation context (the node person in that case), @origin = the node you want to copy (you can take it from another instance), @nodeset = your target for the copy (here your will copy a new occupation node after (@position=after) the node occupation (@nodeset) with position()=index('repeat-occ') (@at='index('repeat-occ')') ) > > Let's try and keep us informed. > > Best, > Josselin. > > Le 11 févr. 2021 à 18:54, Ralph Corrigan <ra...@ra...> a écrit : > > Hi again > I wasn't wrong. > > I'm sure that this is going to be Xpath errors in the <trigger> but <repeat> is not happening. I've stripped back the model (and added a couple of other bits) and working round different Xpath permutations for the groups/elements has given me some confidence in that. But the triggers, while rendering fine, don't do anything. > > As always, any help gratefully appreciated > > Ralph > > <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> > <?xsltforms-options debug="yes"?> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:xf="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > <head> > <title> New Person</title> > <xf:model> > > <xf:instance id="template"> > <items xmlns=""> > <listPerson> > <person xml:id="Unique name" sex="Sex"> > <persName><forename>Forename</forename><surname>Surname</surname></persName> > <occupation><rolename></rolename></occupation> > </person> > </listPerson> > </items> > </xf:instance> > <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> > <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> > </xf:submission> > </xf:model> > > </head> > <body> > <xf:group id="pers" ref="instance('template')/listPerson/person"> > <label>So this bit now works!</label> > <xf:repeat id="repeat" nodeset="instance('template')/listPerson/person"> > <xf:input ref="@xml:id"><xf:label>Unique name</xf:label></xf:input> > <xf:input ref="persName/forename"><xf:label>Forename</xf:label></xf:input> > <xf:input ref="persName/surname"><xf:label>Surname</xf:label></xf:input> > <xf:select1 ref="@sex" appearance="minimal"> > <xf:label>Sex</xf:label> > <xf:item> > <xf:label>Male</xf:label> > <xf:value>1</xf:value> > </xf:item> > <xf:item> > <xf:label>Female</xf:label> > <xf:value>2</xf:value> > </xf:item> > <xf:item> > <xf:label>Unknown</xf:label> > <xf:value>0</xf:value> > </xf:item> > </xf:select1> > > <xf:group id="occupation"> > <xf:repeat id="repeat-occ" nodeset="instance('template')/listPerson/person/occupation"> > <xf:input ref="rolename"><xf:label>Role</xf:label></xf:input> > </xf:repeat> > <xf:trigger> > <xf:label>New role</xf:label> > <insert nodeset="instance('template')/listPerson/person/occupation" at="index('repeat-occ')" > position="after" ev:event="DOMActivate" /> > </xf:trigger> > </xf:group> > > </xf:repeat> > <xf:trigger> > <xf:label>New</xf:label> > <insert nodeset="instance('template')/listPerson/person" at="index('repeat')" > position="after" ev:event="DOMActivate" /> > </xf:trigger> > </xf:group> > > <xf:submit submission="s01"> > <xf:label>View</xf:label> > </xf:submit> > </body> > </html> > > On 10/02/2021 21:40, Ralph Corrigan wrote: > > Many thanks Josselin, I stupidly didn't realise that the whole Xpath was required. > > That's rendering fine now, so on to the <repeat> sections. I fear I may be in touch again, though... > > Thanks again > Ralph > > On 10/02/2021 20:09, Josselin Morvan wrote: > > Hi Ralph, > > I don't know if your are trying to work with the first instance (we cannot access to the listPerson.xml file) or your #template instance, but I suspect an error with your Xpath. > > If your listPerson is a XML-TEI file, your xml-tree should be something like : > > <TEI xmlns="http://www.tei-c.org/ns/1.0"> > <teiHeader/> > <text> > <body> > <listPerson> > <person> > <!-- person 1 --> > <persName> > <surname></surname> > <forename></forename> > </persName> > </person> > </listPerson> > </body> > </text> > </TEI> > > Then if you want to target the surname and forename tags, your Xpath should be something like /TEI/text/body/listPerson/person/persName/surname and /TEI/text/body/listPerson/person/persName/forename. You can use xf:group/@ref to shorten your link : > > <xf:group ref="/TEI/text/body/listPerson/person/persName"> > <label>why does this not work?</label> > <xf:input ref="forename"><label>Forename</label></xf:input> > <xf:input ref="surname"><label>Surname></label></xf:input> > </xf:group> > > If your are trying to work with your #template instance, your Xpath is also wrong and as it is not your first instance, you need to specify it in the @ref : > > <xf:group ref="instance('template')/TEI/text/body/listPerson/person/persName"> > <label>why does this not work?</label> > <xf:input ref="forename"><label>Forename</label></xf:input> > <xf:input ref="surname"><label>Surname></label></xf:input> > </xf:group> > > I think you'll also have to correct your xpath with your trigger to insert a new person. > > Finally, if you plan to manage more than one person at a time, you should take a look at the xf:repeat element. (https://www.w3.org/TR/xforms11/#ui-repeat) > > If you declared a namespace (with listPerson.xml ?) it can also be the origin of your issue as some browsers don't handle the namespace declarations very well, but first let's try with corrected Xpath and keep us informed! > > Best, > Josselin. > > Le 10 févr. 2021 à 19:04, Ralph Corrigan <ra...@ra...> a écrit : > > Hi, > Apologies for this as I'm sure that I'm missing something extremely basic, but I'm having problems with implementing Xsltforms running via an Apache server on a Synology NAS (for now). I'm totally new to Xforms (in any implementation) but have been working with TEI xml and fetchXML for a couple of years, so I'm comfortable with that side of things. > > All of the test forms downloaded with the implementation work fine - they have no problems at all. However, apparently simple changes cause the form to either not render at all (without error message) or with key parts missing. > > In the following example, I've changed some bits of Steve Pemberton's 'todo.xml'. This form is a partial success in that the form does render, and the s01 submission demonstrates that the src xml has been found and read. However, the input fields (and I've deliberately kept this short after the full model failed) do not appear (see image). There are no errors in the trace log and the profiler recognises that the 2 input fields exist. They just aren't being displayed. > > This problem is happening on all the examples I modify - I would understand it (more) if the triggers failed as I'm new to this, but failing to even render input/label seems really odd (and suggests that I'm making a very basic error)! > > Any help gratefully received > > Ralph > > <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> > <?xsltforms-options debug="yes"?> > > <html xmlns="http://www.w3.org/1999/xhtml" > > xmlns:xf="http://www.w3.org/2002/xforms" > > xmlns:ev="http://www.w3.org/2001/xml-events" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > <head> > > <title> New Person</title> > > <xf:model> > > <xf:instance src="listPerson.xml [1]"/> > > <xf:instance id="template"> > > <items xmlns=""> > > <TEI><text><body><listPerson> > > <person> > > <persName><forename>Forename</forename><surname>Surname</surname></persName> > > <occupation><rolename></rolename></occupation> > > </person> > > </listPerson></body></text></TEI> > > </items> > > </xf:instance> > > <xf:submission id="save" method="put" action="listperson.xml" replace="none"/> > > <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> > > <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> > > </xf:submission> > > </xf:model> > > </head> > > <body> > > <xf:group> > > <label>why does this not work?</label> > > <xf:input ref="forename"><label>Forename</label></xf:input> > > <xf:input ref="surname"><label>Surname></label></xf:input> > > </xf:group> > > <xf:trigger> > > <xf:label>New</xf:label> > > <xf:action ev:event="DOMActivate"> > > <xf:insert context="/items" origin="instance('template')/person" nodeset="persName" position="after" at="count(persName)"/> > > </xf:action> > > </xf:trigger> > > <xf:submit submission="s01"> > > <xf:label>View</xf:label> > > </xf:submit> > > </body> > > </html> > > <c709c5ba.png> > > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support _______________________________________________ Xsltforms-support mailing list Xsl...@li... https://lists.sourceforge.net/lists/listinfo/xsltforms-support Links: ------ [1] http://192.168.0.10/ralphy/xslt/listPerson.xml |
From: Josselin M. <mor...@gm...> - 2021-02-11 21:48:12
|
Hi Ralph, For the xf: and non-xf: elements, it depends how and where you declare the xforms namespace. With your form you declared the namespace with the prefix xf: on the html tag : xmlns:xf="http://www.w3.org/2002/xforms", so, as you noticed, you need to use this xf prefix with the xforms elements. Best, Josselin Envoyé de mon iPhone > Le 11 févr. 2021 à 21:31, Ralph Corrigan <ra...@ra...> a écrit : > > > Thanks Josselin, clear explanations as ever! > I tried those changes but initially didn't get anywhere. Certainly the context was wrong in the first <repeat>, but it turns out that - in my instance at least - I needed to mark the <insert> as <xf:insert> - it then worked just as expected, so (sorry, I didn't do the verbose although your explanation was extremely helpful): > > <xf:trigger> > <xf:label>New role</xf:label> > <xf:insert nodeset="instance('template')/listPerson/person/occupation" at="index('repeat-occ')" > position="after" ev:event="DOMActivate" /> > </xf:trigger> > I'm a bit confused by this as the examples in the implementation file have a mix of xf: and non-xf: and work fine, but my xml seems to need every element marked 'xf:'. > > Anyway, many thanks - and hopefully I'll leave you in peace for a while now! > > Ralph > > > >> On 11/02/2021 18:52, Josselin Morvan wrote: >> >> Hi Ralph, >> >> As you specified a xf:group/@ref, everything inside this group starts from that point (you keep the context) >> >> You can try this - the node you want to repeat is your context node ('.' With Xpath ) : >> <xf:group id="pers" ref="instance('template')/listPerson/person"> >> <label>So this bit now works!</label> >> <xf:repeat id="repeat" nodeset="."> >> [...] >> </xf:repeat> >> [...] >> </xf:group> >> Or - you change your xf:group/@ref for the parent node listPerson, and you repeat the child node person : >> <xf:group id="pers" ref="instance('template')/listPerson"> >> <label>So this bit now works!</label> >> <xf:repeat id="repeat" nodeset="person"> >> >> [...] >> </xf:repeat> >> [...] >> </xf:group> >> Same idea for the repeat of occupation, as you already start from the node person, you just need to write : @nodeset='occupation' >> >> For the repeat, I think, at the beginning, you should be verbose to understand how it works : >> >> <insert context="." >> origin="instance('template')/listPerson/person/occupation" >> nodeset="occupation" >> at="index('repeat-occ')" >> position="after" >> ev:event="DOMActivate" /> >> To simplify, @context = your evaluation context (the node person in that case), @origin = the node you want to copy (you can take it from another instance), @nodeset = your target for the copy (here your will copy a new occupation node after (@position=after) the node occupation (@nodeset) with position()=index('repeat-occ') (@at='index('repeat-occ')') ) >> >> Let's try and keep us informed. >> >> Best, >> Josselin. >> >>> Le 11 févr. 2021 à 18:54, Ralph Corrigan <ra...@ra...> a écrit : >>> >>> Hi again >>> I wasn't wrong. >>> >>> I'm sure that this is going to be Xpath errors in the <trigger> but <repeat> is not happening. I've stripped back the model (and added a couple of other bits) and working round different Xpath permutations for the groups/elements has given me some confidence in that. But the triggers, while rendering fine, don't do anything. >>> >>> As always, any help gratefully appreciated >>> >>> Ralph >>> >>> >>> <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> >>> <?xsltforms-options debug="yes"?> >>> <html xmlns="http://www.w3.org/1999/xhtml" >>> xmlns:xf="http://www.w3.org/2002/xforms" >>> xmlns:ev="http://www.w3.org/2001/xml-events" >>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"> >>> >>> <head> >>> <title> New Person</title> >>> <xf:model> >>> >>> <xf:instance id="template"> >>> <items xmlns=""> >>> <listPerson> >>> <person xml:id="Unique name" sex="Sex"> >>> <persName><forename>Forename</forename><surname>Surname</surname></persName> >>> <occupation><rolename></rolename></occupation> >>> </person> >>> </listPerson> >>> </items> >>> </xf:instance> >>> <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> >>> <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> >>> </xf:submission> >>> </xf:model> >>> >>> </head> >>> <body> >>> <xf:group id="pers" ref="instance('template')/listPerson/person"> >>> <label>So this bit now works!</label> >>> <xf:repeat id="repeat" nodeset="instance('template')/listPerson/person"> >>> <xf:input ref="@xml:id"><xf:label>Unique name</xf:label></xf:input> >>> <xf:input ref="persName/forename"><xf:label>Forename</xf:label></xf:input> >>> <xf:input ref="persName/surname"><xf:label>Surname</xf:label></xf:input> >>> <xf:select1 ref="@sex" appearance="minimal"> >>> <xf:label>Sex</xf:label> >>> <xf:item> >>> <xf:label>Male</xf:label> >>> <xf:value>1</xf:value> >>> </xf:item> >>> <xf:item> >>> <xf:label>Female</xf:label> >>> <xf:value>2</xf:value> >>> </xf:item> >>> <xf:item> >>> <xf:label>Unknown</xf:label> >>> <xf:value>0</xf:value> >>> </xf:item> >>> </xf:select1> >>> >>> <xf:group id="occupation"> >>> <xf:repeat id="repeat-occ" nodeset="instance('template')/listPerson/person/occupation"> >>> <xf:input ref="rolename"><xf:label>Role</xf:label></xf:input> >>> </xf:repeat> >>> <xf:trigger> >>> <xf:label>New role</xf:label> >>> <insert nodeset="instance('template')/listPerson/person/occupation" at="index('repeat-occ')" >>> position="after" ev:event="DOMActivate" /> >>> </xf:trigger> >>> </xf:group> >>> >>> </xf:repeat> >>> <xf:trigger> >>> <xf:label>New</xf:label> >>> <insert nodeset="instance('template')/listPerson/person" at="index('repeat')" >>> position="after" ev:event="DOMActivate" /> >>> </xf:trigger> >>> </xf:group> >>> >>> <xf:submit submission="s01"> >>> <xf:label>View</xf:label> >>> </xf:submit> >>> </body> >>> </html> >>> >>> >>> >>> >>> >>> >>> >>> On 10/02/2021 21:40, Ralph Corrigan wrote: >>> >>> Many thanks Josselin, I stupidly didn't realise that the whole Xpath was required. >>> >>> That's rendering fine now, so on to the <repeat> sections. I fear I may be in touch again, though... >>> >>> Thanks again >>> Ralph >>> >>> >>> >>> On 10/02/2021 20:09, Josselin Morvan wrote: >>> >>> Hi Ralph, >>> >>> I don't know if your are trying to work with the first instance (we cannot access to the listPerson.xml file) or your #template instance, but I suspect an error with your Xpath. >>> >>> If your listPerson is a XML-TEI file, your xml-tree should be something like : >>> <TEI xmlns="http://www.tei-c.org/ns/1.0"> >>> <teiHeader/> >>> <text> >>> <body> >>> <listPerson> >>> <person> >>> <!-- person 1 --> >>> <persName> >>> <surname></surname> >>> <forename></forename> >>> </persName> >>> </person> >>> </listPerson> >>> </body> >>> </text> >>> </TEI> >>> Then if you want to target the surname and forename tags, your Xpath should be something like /TEI/text/body/listPerson/person/persName/surname and /TEI/text/body/listPerson/person/persName/forename. You can use xf:group/@ref to shorten your link : >>> <xf:group ref="/TEI/text/body/listPerson/person/persName"> >>> <label>why does this not work?</label> >>> <xf:input ref="forename"><label>Forename</label></xf:input> >>> <xf:input ref="surname"><label>Surname></label></xf:input> >>> </xf:group> >>> >>> If your are trying to work with your #template instance, your Xpath is also wrong and as it is not your first instance, you need to specify it in the @ref : >>> >>> <xf:group ref="instance('template')/TEI/text/body/listPerson/person/persName"> >>> <label>why does this not work?</label> >>> <xf:input ref="forename"><label>Forename</label></xf:input> >>> <xf:input ref="surname"><label>Surname></label></xf:input> >>> </xf:group> >>> >>> I think you'll also have to correct your xpath with your trigger to insert a new person. >>> >>> Finally, if you plan to manage more than one person at a time, you should take a look at the xf:repeat element. (https://www.w3.org/TR/xforms11/#ui-repeat) >>> >>> If you declared a namespace (with listPerson.xml ?) it can also be the origin of your issue as some browsers don't handle the namespace declarations very well, but first let's try with corrected Xpath and keep us informed! >>> >>> >>> Best, >>> Josselin. >>> >>> Le 10 févr. 2021 à 19:04, Ralph Corrigan <ra...@ra...> a écrit : >>> >>> Hi, >>> Apologies for this as I'm sure that I'm missing something extremely basic, but I'm having problems with implementing Xsltforms running via an Apache server on a Synology NAS (for now). I'm totally new to Xforms (in any implementation) but have been working with TEI xml and fetchXML for a couple of years, so I'm comfortable with that side of things. >>> >>> All of the test forms downloaded with the implementation work fine - they have no problems at all. However, apparently simple changes cause the form to either not render at all (without error message) or with key parts missing. >>> >>> In the following example, I've changed some bits of Steve Pemberton's 'todo.xml'. This form is a partial success in that the form does render, and the s01 submission demonstrates that the src xml has been found and read. However, the input fields (and I've deliberately kept this short after the full model failed) do not appear (see image). There are no errors in the trace log and the profiler recognises that the 2 input fields exist. They just aren't being displayed. >>> >>> This problem is happening on all the examples I modify - I would understand it (more) if the triggers failed as I'm new to this, but failing to even render input/label seems really odd (and suggests that I'm making a very basic error)! >>> >>> Any help gratefully received >>> >>> Ralph >>> >>> >>> <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> >>> <?xsltforms-options debug="yes"?> >>> <html xmlns="http://www.w3.org/1999/xhtml" >>> xmlns:xf="http://www.w3.org/2002/xforms" >>> xmlns:ev="http://www.w3.org/2001/xml-events" >>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"> >>> <head> >>> <title> New Person</title> >>> <xf:model> >>> <xf:instance src="listPerson.xml"/> >>> <xf:instance id="template"> >>> <items xmlns=""> >>> <TEI><text><body><listPerson> >>> <person> >>> <persName><forename>Forename</forename><surname>Surname</surname></persName> >>> <occupation><rolename></rolename></occupation> >>> </person> >>> </listPerson></body></text></TEI> >>> </items> >>> </xf:instance> >>> <xf:submission id="save" method="put" action="listperson.xml" replace="none"/> >>> <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> >>> <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> >>> </xf:submission> >>> </xf:model> >>> >>> </head> >>> <body> >>> <xf:group> >>> <label>why does this not work?</label> >>> >>> <xf:input ref="forename"><label>Forename</label></xf:input> >>> <xf:input ref="surname"><label>Surname></label></xf:input> >>> >>> </xf:group> >>> <xf:trigger> >>> <xf:label>New</xf:label> >>> <xf:action ev:event="DOMActivate"> >>> <xf:insert context="/items" origin="instance('template')/person" nodeset="persName" position="after" at="count(persName)"/> >>> </xf:action> >>> </xf:trigger> >>> <xf:submit submission="s01"> >>> <xf:label>View</xf:label> >>> </xf:submit> >>> </body> >>> </html> >>> <c709c5ba.png> >>> >>> _______________________________________________ >>> Xsltforms-support mailing list >>> Xsl...@li... >>> https://lists.sourceforge.net/lists/listinfo/xsltforms-support >>> >>> _______________________________________________ >>> Xsltforms-support mailing list >>> Xsl...@li... >>> https://lists.sourceforge.net/lists/listinfo/xsltforms-support |
From: Ralph C. <ra...@ra...> - 2021-02-11 20:31:26
|
Thanks Josselin, clear explanations as ever! I tried those changes but initially didn't get anywhere. Certainly the context was wrong in the first <repeat>, but it turns out that - in my instance at least - I needed to mark the <insert> as <xf:insert> - it then worked just as expected, so (sorry, I didn't do the verbose although your explanation was extremely helpful): <xf:trigger> <xf:label>New role</xf:label> <xf:insert nodeset="instance('template')/listPerson/person/occupation" at="index('repeat-occ')" position="after" ev:event="DOMActivate" /> </xf:trigger> I'm a bit confused by this as the examples in the implementation file have a mix of xf: and non-xf: and work fine, but my xml seems to need every element marked 'xf:'. Anyway, many thanks - and hopefully I'll leave you in peace for a while now! Ralph On 11/02/2021 18:52, Josselin Morvan wrote: > Hi Ralph, > > As you specified a xf:group/@ref, everything inside this group starts from that point (you keep the context) > > You can try this - the node you want to repeat is your context node ('.' With Xpath ) : > > <xf:group id="pers" ref="instance('template')/listPerson/person"> > <label>So this bit now works!</label> > <xf:repeat id="repeat" nodeset="."> > [...] > </xf:repeat> > [...] > </xf:group> > > Or - you change your xf:group/@ref for the parent node listPerson, and you repeat the child node person : > > <xf:group id="pers" ref="instance('template')/listPerson"> > <label>So this bit now works!</label> > <xf:repeat id="repeat" nodeset="person"> > > [...] > </xf:repeat> > [...] > </xf:group> > > Same idea for the repeat of occupation, as you already start from the node person, you just need to write : @nodeset='occupation' > > For the repeat, I think, at the beginning, you should be verbose to understand how it works : > > <insert context="." > origin="instance('template')/listPerson/person/occupation" > nodeset="occupation" > at="index('repeat-occ')" > position="after" > ev:event="DOMActivate" /> > > To simplify, @context = your evaluation context (the node person in that case), @origin = the node you want to copy (you can take it from another instance), @nodeset = your target for the copy (here your will copy a new occupation node after (@position=after) the node occupation (@nodeset) with position()=index('repeat-occ') (@at='index('repeat-occ')') ) > > Let's try and keep us informed. > > Best, > Josselin. > > Le 11 févr. 2021 à 18:54, Ralph Corrigan <ra...@ra...> a écrit : > > Hi again > I wasn't wrong. > > I'm sure that this is going to be Xpath errors in the <trigger> but <repeat> is not happening. I've stripped back the model (and added a couple of other bits) and working round different Xpath permutations for the groups/elements has given me some confidence in that. But the triggers, while rendering fine, don't do anything. > > As always, any help gratefully appreciated > > Ralph > > <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> > <?xsltforms-options debug="yes"?> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:xf="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > <head> > <title> New Person</title> > <xf:model> > > <xf:instance id="template"> > <items xmlns=""> > <listPerson> > <person xml:id="Unique name" sex="Sex"> > <persName><forename>Forename</forename><surname>Surname</surname></persName> > <occupation><rolename></rolename></occupation> > </person> > </listPerson> > </items> > </xf:instance> > <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> > <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> > </xf:submission> > </xf:model> > > </head> > <body> > <xf:group id="pers" ref="instance('template')/listPerson/person"> > <label>So this bit now works!</label> > <xf:repeat id="repeat" nodeset="instance('template')/listPerson/person"> > <xf:input ref="@xml:id"><xf:label>Unique name</xf:label></xf:input> > <xf:input ref="persName/forename"><xf:label>Forename</xf:label></xf:input> > <xf:input ref="persName/surname"><xf:label>Surname</xf:label></xf:input> > <xf:select1 ref="@sex" appearance="minimal"> > <xf:label>Sex</xf:label> > <xf:item> > <xf:label>Male</xf:label> > <xf:value>1</xf:value> > </xf:item> > <xf:item> > <xf:label>Female</xf:label> > <xf:value>2</xf:value> > </xf:item> > <xf:item> > <xf:label>Unknown</xf:label> > <xf:value>0</xf:value> > </xf:item> > </xf:select1> > > <xf:group id="occupation"> > <xf:repeat id="repeat-occ" nodeset="instance('template')/listPerson/person/occupation"> > <xf:input ref="rolename"><xf:label>Role</xf:label></xf:input> > </xf:repeat> > <xf:trigger> > <xf:label>New role</xf:label> > <insert nodeset="instance('template')/listPerson/person/occupation" at="index('repeat-occ')" > position="after" ev:event="DOMActivate" /> > </xf:trigger> > </xf:group> > > </xf:repeat> > <xf:trigger> > <xf:label>New</xf:label> > <insert nodeset="instance('template')/listPerson/person" at="index('repeat')" > position="after" ev:event="DOMActivate" /> > </xf:trigger> > </xf:group> > > <xf:submit submission="s01"> > <xf:label>View</xf:label> > </xf:submit> > </body> > </html> > > On 10/02/2021 21:40, Ralph Corrigan wrote: > > Many thanks Josselin, I stupidly didn't realise that the whole Xpath was required. > > That's rendering fine now, so on to the <repeat> sections. I fear I may be in touch again, though... > > Thanks again > Ralph > > On 10/02/2021 20:09, Josselin Morvan wrote: > > Hi Ralph, > > I don't know if your are trying to work with the first instance (we cannot access to the listPerson.xml file) or your #template instance, but I suspect an error with your Xpath. > > If your listPerson is a XML-TEI file, your xml-tree should be something like : > > <TEI xmlns="http://www.tei-c.org/ns/1.0"> > <teiHeader/> > <text> > <body> > <listPerson> > <person> > <!-- person 1 --> > <persName> > <surname></surname> > <forename></forename> > </persName> > </person> > </listPerson> > </body> > </text> > </TEI> > > Then if you want to target the surname and forename tags, your Xpath should be something like /TEI/text/body/listPerson/person/persName/surname and /TEI/text/body/listPerson/person/persName/forename. You can use xf:group/@ref to shorten your link : > > <xf:group ref="/TEI/text/body/listPerson/person/persName"> > <label>why does this not work?</label> > <xf:input ref="forename"><label>Forename</label></xf:input> > <xf:input ref="surname"><label>Surname></label></xf:input> > </xf:group> > > If your are trying to work with your #template instance, your Xpath is also wrong and as it is not your first instance, you need to specify it in the @ref : > > <xf:group ref="instance('template')/TEI/text/body/listPerson/person/persName"> > <label>why does this not work?</label> > <xf:input ref="forename"><label>Forename</label></xf:input> > <xf:input ref="surname"><label>Surname></label></xf:input> > </xf:group> > > I think you'll also have to correct your xpath with your trigger to insert a new person. > > Finally, if you plan to manage more than one person at a time, you should take a look at the xf:repeat element. (https://www.w3.org/TR/xforms11/#ui-repeat) > > If you declared a namespace (with listPerson.xml ?) it can also be the origin of your issue as some browsers don't handle the namespace declarations very well, but first let's try with corrected Xpath and keep us informed! > > Best, > Josselin. > > Le 10 févr. 2021 à 19:04, Ralph Corrigan <ra...@ra...> a écrit : > > Hi, > Apologies for this as I'm sure that I'm missing something extremely basic, but I'm having problems with implementing Xsltforms running via an Apache server on a Synology NAS (for now). I'm totally new to Xforms (in any implementation) but have been working with TEI xml and fetchXML for a couple of years, so I'm comfortable with that side of things. > > All of the test forms downloaded with the implementation work fine - they have no problems at all. However, apparently simple changes cause the form to either not render at all (without error message) or with key parts missing. > > In the following example, I've changed some bits of Steve Pemberton's 'todo.xml'. This form is a partial success in that the form does render, and the s01 submission demonstrates that the src xml has been found and read. However, the input fields (and I've deliberately kept this short after the full model failed) do not appear (see image). There are no errors in the trace log and the profiler recognises that the 2 input fields exist. They just aren't being displayed. > > This problem is happening on all the examples I modify - I would understand it (more) if the triggers failed as I'm new to this, but failing to even render input/label seems really odd (and suggests that I'm making a very basic error)! > > Any help gratefully received > > Ralph > > <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> > <?xsltforms-options debug="yes"?> > > <html xmlns="http://www.w3.org/1999/xhtml" > > xmlns:xf="http://www.w3.org/2002/xforms" > > xmlns:ev="http://www.w3.org/2001/xml-events" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > <head> > > <title> New Person</title> > > <xf:model> > > <xf:instance src="listPerson.xml [1]"/> > > <xf:instance id="template"> > > <items xmlns=""> > > <TEI><text><body><listPerson> > > <person> > > <persName><forename>Forename</forename><surname>Surname</surname></persName> > > <occupation><rolename></rolename></occupation> > > </person> > > </listPerson></body></text></TEI> > > </items> > > </xf:instance> > > <xf:submission id="save" method="put" action="listperson.xml" replace="none"/> > > <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> > > <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> > > </xf:submission> > > </xf:model> > > </head> > > <body> > > <xf:group> > > <label>why does this not work?</label> > > <xf:input ref="forename"><label>Forename</label></xf:input> > > <xf:input ref="surname"><label>Surname></label></xf:input> > > </xf:group> > > <xf:trigger> > > <xf:label>New</xf:label> > > <xf:action ev:event="DOMActivate"> > > <xf:insert context="/items" origin="instance('template')/person" nodeset="persName" position="after" at="count(persName)"/> > > </xf:action> > > </xf:trigger> > > <xf:submit submission="s01"> > > <xf:label>View</xf:label> > > </xf:submit> > > </body> > > </html> > > <c709c5ba.png> > > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support _______________________________________________ Xsltforms-support mailing list Xsl...@li... https://lists.sourceforge.net/lists/listinfo/xsltforms-support Links: ------ [1] http://192.168.0.10/ralphy/xslt/listPerson.xml |
From: Josselin M. <mor...@gm...> - 2021-02-11 18:52:34
|
Hi Ralph, As you specified a xf:group/@ref, everything inside this group starts from that point (you keep the context) You can try this - the node you want to repeat is your context node ('.' With Xpath ) : <xf:group id="pers" ref="instance('template')/listPerson/person"> <label>So this bit now works!</label> <xf:repeat id="repeat" nodeset="."> […] </xf:repeat> […] </xf:group> Or - you change your xf:group/@ref for the parent node listPerson, and you repeat the child node person : <xf:group id="pers" ref="instance('template')/listPerson"> <label>So this bit now works!</label> <xf:repeat id="repeat" nodeset="person"> […] </xf:repeat> […] </xf:group> Same idea for the repeat of occupation, as you already start from the node person, you just need to write : @nodeset=‘occupation' For the repeat, I think, at the beginning, you should be verbose to understand how it works : <insert context="." origin="instance('template')/listPerson/person/occupation" nodeset="occupation" at="index('repeat-occ')" position="after" ev:event="DOMActivate" /> To simplify, @context = your evaluation context (the node person in that case), @origin = the node you want to copy (you can take it from another instance), @nodeset = your target for the copy (here your will copy a new occupation node after (@position=after) the node occupation (@nodeset) with position()=index(‘repeat-occ’) (@at='index(‘repeat-occ')') ) Let’s try and keep us informed. Best, Josselin. > Le 11 févr. 2021 à 18:54, Ralph Corrigan <ra...@ra...> a écrit : > > Hi again > I wasn't wrong. > > I'm sure that this is going to be Xpath errors in the <trigger> but <repeat> is not happening. I've stripped back the model (and added a couple of other bits) and working round different Xpath permutations for the groups/elements has given me some confidence in that. But the triggers, while rendering fine, don't do anything. > > As always, any help gratefully appreciated > > Ralph > > > <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> > <?xsltforms-options debug="yes"?> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:xf="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > <head> > <title> New Person</title> > <xf:model> > > <xf:instance id="template"> > <items xmlns=""> > <listPerson> > <person xml:id="Unique name" sex="Sex"> > <persName><forename>Forename</forename><surname>Surname</surname></persName> > <occupation><rolename></rolename></occupation> > </person> > </listPerson> > </items> > </xf:instance> > <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> > <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> > </xf:submission> > </xf:model> > > </head> > <body> > <xf:group id="pers" ref="instance('template')/listPerson/person"> > <label>So this bit now works!</label> > <xf:repeat id="repeat" nodeset="instance('template')/listPerson/person"> > <xf:input ref="@xml:id"><xf:label>Unique name</xf:label></xf:input> > <xf:input ref="persName/forename"><xf:label>Forename</xf:label></xf:input> > <xf:input ref="persName/surname"><xf:label>Surname</xf:label></xf:input> > <xf:select1 ref="@sex" appearance="minimal"> > <xf:label>Sex</xf:label> > <xf:item> > <xf:label>Male</xf:label> > <xf:value>1</xf:value> > </xf:item> > <xf:item> > <xf:label>Female</xf:label> > <xf:value>2</xf:value> > </xf:item> > <xf:item> > <xf:label>Unknown</xf:label> > <xf:value>0</xf:value> > </xf:item> > </xf:select1> > > <xf:group id="occupation"> > <xf:repeat id="repeat-occ" nodeset="instance('template')/listPerson/person/occupation"> > <xf:input ref="rolename"><xf:label>Role</xf:label></xf:input> > </xf:repeat> > <xf:trigger> > <xf:label>New role</xf:label> > <insert nodeset="instance('template')/listPerson/person/occupation" at="index('repeat-occ')" > position="after" ev:event="DOMActivate" /> > </xf:trigger> > </xf:group> > > </xf:repeat> > <xf:trigger> > <xf:label>New</xf:label> > <insert nodeset="instance('template')/listPerson/person" at="index('repeat')" > position="after" ev:event="DOMActivate" /> > </xf:trigger> > </xf:group> > > <xf:submit submission="s01"> > <xf:label>View</xf:label> > </xf:submit> > </body> > </html> > > > > > > > > On 10/02/2021 21:40, Ralph Corrigan wrote: > >> Many thanks Josselin, I stupidly didn't realise that the whole Xpath was required. >> >> That's rendering fine now, so on to the <repeat> sections. I fear I may be in touch again, though... >> >> Thanks again >> Ralph >> >> >> >> On 10/02/2021 20:09, Josselin Morvan wrote: >> >> Hi Ralph, >> >> I don't know if your are trying to work with the first instance (we cannot access to the listPerson.xml file) or your #template instance, but I suspect an error with your Xpath. >> >> If your listPerson is a XML-TEI file, your xml-tree should be something like : >> <TEI xmlns="http://www.tei-c.org/ns/1.0 <http://www.tei-c.org/ns/1.0>"> >> <teiHeader/> >> <text> >> <body> >> <listPerson> >> <person> >> <!-- person 1 --> >> <persName> >> <surname></surname> >> <forename></forename> >> </persName> >> </person> >> </listPerson> >> </body> >> </text> >> </TEI> >> Then if you want to target the surname and forename tags, your Xpath should be something like /TEI/text/body/listPerson/person/persName/surname and /TEI/text/body/listPerson/person/persName/forename. You can use xf:group/@ref to shorten your link : >> <xf:group ref="/TEI/text/body/listPerson/person/persName"> >> <label>why does this not work?</label> >> <xf:input ref="forename"><label>Forename</label></xf:input> >> <xf:input ref="surname"><label>Surname></label></xf:input> >> </xf:group> >> >> If your are trying to work with your #template instance, your Xpath is also wrong and as it is not your first instance, you need to specify it in the @ref : >> >> <xf:group ref="instance('template')/TEI/text/body/listPerson/person/persName"> >> <label>why does this not work?</label> >> <xf:input ref="forename"><label>Forename</label></xf:input> >> <xf:input ref="surname"><label>Surname></label></xf:input> >> </xf:group> >> >> I think you'll also have to correct your xpath with your trigger to insert a new person. >> >> Finally, if you plan to manage more than one person at a time, you should take a look at the xf:repeat element. (https://www.w3.org/TR/xforms11/#ui-repeat <https://www.w3.org/TR/xforms11/#ui-repeat>) >> >> If you declared a namespace (with listPerson.xml ?) it can also be the origin of your issue as some browsers don't handle the namespace declarations very well, but first let's try with corrected Xpath and keep us informed! >> >> >> Best, >> Josselin. >> >> Le 10 févr. 2021 à 19:04, Ralph Corrigan <ra...@ra... <mailto:ra...@ra...>> a écrit : >> >> Hi, >> Apologies for this as I'm sure that I'm missing something extremely basic, but I'm having problems with implementing Xsltforms running via an Apache server on a Synology NAS (for now). I'm totally new to Xforms (in any implementation) but have been working with TEI xml and fetchXML for a couple of years, so I'm comfortable with that side of things. >> >> All of the test forms downloaded with the implementation work fine - they have no problems at all. However, apparently simple changes cause the form to either not render at all (without error message) or with key parts missing. >> >> In the following example, I've changed some bits of Steve Pemberton's 'todo.xml'. This form is a partial success in that the form does render, and the s01 submission demonstrates that the src xml has been found and read. However, the input fields (and I've deliberately kept this short after the full model failed) do not appear (see image). There are no errors in the trace log and the profiler recognises that the 2 input fields exist. They just aren't being displayed. >> >> This problem is happening on all the examples I modify - I would understand it (more) if the triggers failed as I'm new to this, but failing to even render input/label seems really odd (and suggests that I'm making a very basic error)! >> >> Any help gratefully received >> >> Ralph >> >> >> <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> >> <?xsltforms-options debug="yes"?> >> <html xmlns="http://www.w3.org/1999/xhtml <http://www.w3.org/1999/xhtml>" >> xmlns:xf="http://www.w3.org/2002/xforms <http://www.w3.org/2002/xforms>" >> xmlns:ev="http://www.w3.org/2001/xml-events <http://www.w3.org/2001/xml-events>" >> xmlns:xsd="http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema>"> >> <head> >> <title> New Person</title> >> <xf:model> >> <xf:instance src="listPerson.xml <http://192.168.0.10/ralphy/xslt/listPerson.xml>"/> >> <xf:instance id="template"> >> <items xmlns=""> >> <TEI><text><body><listPerson> >> <person> >> <persName><forename>Forename</forename><surname>Surname</surname></persName> >> <occupation><rolename></rolename></occupation> >> </person> >> </listPerson></body></text></TEI> >> </items> >> </xf:instance> >> <xf:submission id="save" method="put" action="listperson.xml" replace="none"/> >> <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> >> <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> >> </xf:submission> >> </xf:model> >> >> </head> >> <body> >> <xf:group> >> <label>why does this not work?</label> >> >> <xf:input ref="forename"><label>Forename</label></xf:input> >> <xf:input ref="surname"><label>Surname></label></xf:input> >> >> </xf:group> >> <xf:trigger> >> <xf:label>New</xf:label> >> <xf:action ev:event="DOMActivate"> >> <xf:insert context="/items" origin="instance('template')/person" nodeset="persName" position="after" at="count(persName)"/> >> </xf:action> >> </xf:trigger> >> <xf:submit submission="s01"> >> <xf:label>View</xf:label> >> </xf:submit> >> </body> >> </html> >> <c709c5ba.png> >> >> _______________________________________________ >> Xsltforms-support mailing list >> Xsl...@li... <mailto:Xsl...@li...> >> https://lists.sourceforge.net/lists/listinfo/xsltforms-support >> >> _______________________________________________ >> Xsltforms-support mailing list >> Xsl...@li... <mailto:Xsl...@li...> >> https://lists.sourceforge.net/lists/listinfo/xsltforms-support <https://lists.sourceforge.net/lists/listinfo/xsltforms-support> |
From: Ralph C. <ra...@ra...> - 2021-02-11 17:54:27
|
Hi again I wasn't wrong. I'm sure that this is going to be Xpath errors in the <trigger> but <repeat> is not happening. I've stripped back the model (and added a couple of other bits) and working round different Xpath permutations for the groups/elements has given me some confidence in that. But the triggers, while rendering fine, don't do anything. As always, any help gratefully appreciated Ralph <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> <?xsltforms-options debug="yes"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <head> <title> New Person</title> <xf:model> <xf:instance id="template"> <items xmlns=""> <listPerson> <person xml:id="Unique name" sex="Sex"> <persName><forename>Forename</forename><surname>Surname</surname></persName> <occupation><rolename></rolename></occupation> </person> </listPerson> </items> </xf:instance> <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> </xf:submission> </xf:model> </head> <body> <xf:group id="pers" ref="instance('template')/listPerson/person"> <label>So this bit now works!</label> <xf:repeat id="repeat" nodeset="instance('template')/listPerson/person"> <xf:input ref="@xml:id"><xf:label>Unique name</xf:label></xf:input> <xf:input ref="persName/forename"><xf:label>Forename</xf:label></xf:input> <xf:input ref="persName/surname"><xf:label>Surname</xf:label></xf:input> <xf:select1 ref="@sex" appearance="minimal"> <xf:label>Sex</xf:label> <xf:item> <xf:label>Male</xf:label> <xf:value>1</xf:value> </xf:item> <xf:item> <xf:label>Female</xf:label> <xf:value>2</xf:value> </xf:item> <xf:item> <xf:label>Unknown</xf:label> <xf:value>0</xf:value> </xf:item> </xf:select1> <xf:group id="occupation"> <xf:repeat id="repeat-occ" nodeset="instance('template')/listPerson/person/occupation"> <xf:input ref="rolename"><xf:label>Role</xf:label></xf:input> </xf:repeat> <xf:trigger> <xf:label>New role</xf:label> <insert nodeset="instance('template')/listPerson/person/occupation" at="index('repeat-occ')" position="after" ev:event="DOMActivate" /> </xf:trigger> </xf:group> </xf:repeat> <xf:trigger> <xf:label>New</xf:label> <insert nodeset="instance('template')/listPerson/person" at="index('repeat')" position="after" ev:event="DOMActivate" /> </xf:trigger> </xf:group> <xf:submit submission="s01"> <xf:label>View</xf:label> </xf:submit> </body> </html> On 10/02/2021 21:40, Ralph Corrigan wrote: > Many thanks Josselin, I stupidly didn't realise that the whole Xpath was required. > > That's rendering fine now, so on to the <repeat> sections. I fear I may be in touch again, though... > > Thanks again > Ralph > > On 10/02/2021 20:09, Josselin Morvan wrote: > > Hi Ralph, > > I don't know if your are trying to work with the first instance (we cannot access to the listPerson.xml file) or your #template instance, but I suspect an error with your Xpath. > > If your listPerson is a XML-TEI file, your xml-tree should be something like : > > <TEI xmlns="http://www.tei-c.org/ns/1.0"> > <teiHeader/> > <text> > <body> > <listPerson> > <person> > <!-- person 1 --> > <persName> > <surname></surname> > <forename></forename> > </persName> > </person> > </listPerson> > </body> > </text> > </TEI> > > Then if you want to target the surname and forename tags, your Xpath should be something like /TEI/text/body/listPerson/person/persName/surname and /TEI/text/body/listPerson/person/persName/forename. You can use xf:group/@ref to shorten your link : > > <xf:group ref="/TEI/text/body/listPerson/person/persName"> > <label>why does this not work?</label> > <xf:input ref="forename"><label>Forename</label></xf:input> > <xf:input ref="surname"><label>Surname></label></xf:input> > </xf:group> > > If your are trying to work with your #template instance, your Xpath is also wrong and as it is not your first instance, you need to specify it in the @ref : > > <xf:group ref="instance('template')/TEI/text/body/listPerson/person/persName"> > <label>why does this not work?</label> > <xf:input ref="forename"><label>Forename</label></xf:input> > <xf:input ref="surname"><label>Surname></label></xf:input> > </xf:group> > > I think you'll also have to correct your xpath with your trigger to insert a new person. > > Finally, if you plan to manage more than one person at a time, you should take a look at the xf:repeat element. (https://www.w3.org/TR/xforms11/#ui-repeat) > > If you declared a namespace (with listPerson.xml ?) it can also be the origin of your issue as some browsers don't handle the namespace declarations very well, but first let's try with corrected Xpath and keep us informed! > > Best, > Josselin. > > Le 10 févr. 2021 à 19:04, Ralph Corrigan <ra...@ra...> a écrit : > > Hi, > Apologies for this as I'm sure that I'm missing something extremely basic, but I'm having problems with implementing Xsltforms running via an Apache server on a Synology NAS (for now). I'm totally new to Xforms (in any implementation) but have been working with TEI xml and fetchXML for a couple of years, so I'm comfortable with that side of things. > > All of the test forms downloaded with the implementation work fine - they have no problems at all. However, apparently simple changes cause the form to either not render at all (without error message) or with key parts missing. > > In the following example, I've changed some bits of Steve Pemberton's 'todo.xml'. This form is a partial success in that the form does render, and the s01 submission demonstrates that the src xml has been found and read. However, the input fields (and I've deliberately kept this short after the full model failed) do not appear (see image). There are no errors in the trace log and the profiler recognises that the 2 input fields exist. They just aren't being displayed. > > This problem is happening on all the examples I modify - I would understand it (more) if the triggers failed as I'm new to this, but failing to even render input/label seems really odd (and suggests that I'm making a very basic error)! > > Any help gratefully received > > Ralph > > <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> > <?xsltforms-options debug="yes"?> > > <html xmlns="http://www.w3.org/1999/xhtml" > > xmlns:xf="http://www.w3.org/2002/xforms" > > xmlns:ev="http://www.w3.org/2001/xml-events" > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > > <head> > > <title> New Person</title> > > <xf:model> > > <xf:instance src="listPerson.xml [1]"/> > > <xf:instance id="template"> > > <items xmlns=""> > > <TEI><text><body><listPerson> > > <person> > > <persName><forename>Forename</forename><surname>Surname</surname></persName> > > <occupation><rolename></rolename></occupation> > > </person> > > </listPerson></body></text></TEI> > > </items> > > </xf:instance> > > <xf:submission id="save" method="put" action="listperson.xml" replace="none"/> > > <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> > > <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> > > </xf:submission> > > </xf:model> > > </head> > > <body> > > <xf:group> > > <label>why does this not work?</label> > > <xf:input ref="forename"><label>Forename</label></xf:input> > > <xf:input ref="surname"><label>Surname></label></xf:input> > > </xf:group> > > <xf:trigger> > > <xf:label>New</xf:label> > > <xf:action ev:event="DOMActivate"> > > <xf:insert context="/items" origin="instance('template')/person" nodeset="persName" position="after" at="count(persName)"/> > > </xf:action> > > </xf:trigger> > > <xf:submit submission="s01"> > > <xf:label>View</xf:label> > > </xf:submit> > > </body> > > </html> > > <c709c5ba.png> > > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support _______________________________________________ Xsltforms-support mailing list Xsl...@li... https://lists.sourceforge.net/lists/listinfo/xsltforms-support Links: ------ [1] http://192.168.0.10/ralphy/xslt/listPerson.xml |
From: Ralph C. <ra...@ra...> - 2021-02-10 21:41:03
|
Many thanks Josselin, I stupidly didn't realise that the whole Xpath was required. That's rendering fine now, so on to the <repeat> sections. I fear I may be in touch again, though... Thanks again Ralph On 10/02/2021 20:09, Josselin Morvan wrote: > Hi Ralph, > > I don't know if your are trying to work with the first instance (we cannot access to the listPerson.xml file) or your #template instance, but I suspect an error with your Xpath. > > If your listPerson is a XML-TEI file, your xml-tree should be something like : > > <TEI xmlns="http://www.tei-c.org/ns/1.0"> > <teiHeader/> > <text> > <body> > <listPerson> > <person> > <!-- person 1 --> > <persName> > <surname></surname> > <forename></forename> > </persName> > </person> > </listPerson> > </body> > </text> > </TEI> > > Then if you want to target the surname and forename tags, your Xpath should be something like /TEI/text/body/listPerson/person/persName/surname and /TEI/text/body/listPerson/person/persName/forename. You can use xf:group/@ref to shorten your link : > > <xf:group ref="/TEI/text/body/listPerson/person/persName"> > <label>why does this not work?</label> > <xf:input ref="forename"><label>Forename</label></xf:input> > <xf:input ref="surname"><label>Surname></label></xf:input> > </xf:group> > > If your are trying to work with your #template instance, your Xpath is also wrong and as it is not your first instance, you need to specify it in the @ref : > > <xf:group ref="instance('template')/TEI/text/body/listPerson/person/persName"> > <label>why does this not work?</label> > <xf:input ref="forename"><label>Forename</label></xf:input> > <xf:input ref="surname"><label>Surname></label></xf:input> > </xf:group> > > I think you'll also have to correct your xpath with your trigger to insert a new person. > > Finally, if you plan to manage more than one person at a time, you should take a look at the xf:repeat element. (https://www.w3.org/TR/xforms11/#ui-repeat) > > If you declared a namespace (with listPerson.xml ?) it can also be the origin of your issue as some browsers don't handle the namespace declarations very well, but first let's try with corrected Xpath and keep us informed! > > Best, > Josselin. > >> Le 10 févr. 2021 à 19:04, Ralph Corrigan <ra...@ra...> a écrit : >> >> Hi, >> Apologies for this as I'm sure that I'm missing something extremely basic, but I'm having problems with implementing Xsltforms running via an Apache server on a Synology NAS (for now). I'm totally new to Xforms (in any implementation) but have been working with TEI xml and fetchXML for a couple of years, so I'm comfortable with that side of things. >> >> All of the test forms downloaded with the implementation work fine - they have no problems at all. However, apparently simple changes cause the form to either not render at all (without error message) or with key parts missing. >> >> In the following example, I've changed some bits of Steve Pemberton's 'todo.xml'. This form is a partial success in that the form does render, and the s01 submission demonstrates that the src xml has been found and read. However, the input fields (and I've deliberately kept this short after the full model failed) do not appear (see image). There are no errors in the trace log and the profiler recognises that the 2 input fields exist. They just aren't being displayed. >> >> This problem is happening on all the examples I modify - I would understand it (more) if the triggers failed as I'm new to this, but failing to even render input/label seems really odd (and suggests that I'm making a very basic error)! >> >> Any help gratefully received >> >> Ralph >> >> <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> >> <?xsltforms-options debug="yes"?> >> >> <html xmlns="http://www.w3.org/1999/xhtml" >> >> xmlns:xf="http://www.w3.org/2002/xforms" >> >> xmlns:ev="http://www.w3.org/2001/xml-events" >> >> xmlns:xsd="http://www.w3.org/2001/XMLSchema"> >> >> <head> >> >> <title> New Person</title> >> >> <xf:model> >> >> <xf:instance src="listPerson.xml [1]"/> >> >> <xf:instance id="template"> >> >> <items xmlns=""> >> >> <TEI><text><body><listPerson> >> >> <person> >> >> <persName><forename>Forename</forename><surname>Surname</surname></persName> >> >> <occupation><rolename></rolename></occupation> >> >> </person> >> >> </listPerson></body></text></TEI> >> >> </items> >> >> </xf:instance> >> >> <xf:submission id="save" method="put" action="listperson.xml" replace="none"/> >> >> <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> >> >> <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> >> >> </xf:submission> >> >> </xf:model> >> >> </head> >> >> <body> >> >> <xf:group> >> >> <label>why does this not work?</label> >> >> <xf:input ref="forename"><label>Forename</label></xf:input> >> >> <xf:input ref="surname"><label>Surname></label></xf:input> >> >> </xf:group> >> >> <xf:trigger> >> >> <xf:label>New</xf:label> >> >> <xf:action ev:event="DOMActivate"> >> >> <xf:insert context="/items" origin="instance('template')/person" nodeset="persName" position="after" at="count(persName)"/> >> >> </xf:action> >> >> </xf:trigger> >> >> <xf:submit submission="s01"> >> >> <xf:label>View</xf:label> >> >> </xf:submit> >> >> </body> >> >> </html> >> >> <c709c5ba.png> >> >> _______________________________________________ >> Xsltforms-support mailing list >> Xsl...@li... >> https://lists.sourceforge.net/lists/listinfo/xsltforms-support Links: ------ [1] http://192.168.0.10/ralphy/xslt/listPerson.xml |
From: Josselin M. <mor...@gm...> - 2021-02-10 20:09:55
|
Hi Ralph, I don’t know if your are trying to work with the first instance (we cannot access to the listPerson.xml file) or your #template instance, but I suspect an error with your Xpath. If your listPerson is a XML-TEI file, your xml-tree should be something like : <TEI xmlns="http://www.tei-c.org/ns/1.0"> <teiHeader/> <text> <body> <listPerson> <person> <!-- person 1 --> <persName> <surname></surname> <forename></forename> </persName> </person> </listPerson> </body> </text> </TEI> Then if you want to target the surname and forename tags, your Xpath should be something like /TEI/text/body/listPerson/person/persName/surname and /TEI/text/body/listPerson/person/persName/forename. You can use xf:group/@ref to shorten your link : <xf:group ref="/TEI/text/body/listPerson/person/persName"> <label>why does this not work?</label> <xf:input ref="forename"><label>Forename</label></xf:input> <xf:input ref="surname"><label>Surname></label></xf:input> </xf:group> If your are trying to work with your #template instance, your Xpath is also wrong and as it is not your first instance, you need to specify it in the @ref : <xf:group ref="instance('template')/TEI/text/body/listPerson/person/persName"> <label>why does this not work?</label> <xf:input ref="forename"><label>Forename</label></xf:input> <xf:input ref="surname"><label>Surname></label></xf:input> </xf:group> I think you’ll also have to correct your xpath with your trigger to insert a new person. Finally, if you plan to manage more than one person at a time, you should take a look at the xf:repeat element. (https://www.w3.org/TR/xforms11/#ui-repeat <https://www.w3.org/TR/xforms11/#ui-repeat>) If you declared a namespace (with listPerson.xml ?) it can also be the origin of your issue as some browsers don’t handle the namespace declarations very well, but first let’s try with corrected Xpath and keep us informed! Best, Josselin. > Le 10 févr. 2021 à 19:04, Ralph Corrigan <ra...@ra...> a écrit : > > Hi, > Apologies for this as I'm sure that I'm missing something extremely basic, but I'm having problems with implementing Xsltforms running via an Apache server on a Synology NAS (for now). I'm totally new to Xforms (in any implementation) but have been working with TEI xml and fetchXML for a couple of years, so I'm comfortable with that side of things. > > All of the test forms downloaded with the implementation work fine - they have no problems at all. However, apparently simple changes cause the form to either not render at all (without error message) or with key parts missing. > > In the following example, I've changed some bits of Steve Pemberton's 'todo.xml'. This form is a partial success in that the form does render, and the s01 submission demonstrates that the src xml has been found and read. However, the input fields (and I've deliberately kept this short after the full model failed) do not appear (see image). There are no errors in the trace log and the profiler recognises that the 2 input fields exist. They just aren't being displayed. > > This problem is happening on all the examples I modify - I would understand it (more) if the triggers failed as I'm new to this, but failing to even render input/label seems really odd (and suggests that I'm making a very basic error)! > > Any help gratefully received > > Ralph > > > <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> > <?xsltforms-options debug="yes"?> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:xf="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> > <head> > <title> New Person</title> > <xf:model> > <xf:instance src="listPerson.xml <http://192.168.0.10/ralphy/xslt/listPerson.xml>"/> > <xf:instance id="template"> > <items xmlns=""> > <TEI><text><body><listPerson> > <person> > <persName><forename>Forename</forename><surname>Surname</surname></persName> > <occupation><rolename></rolename></occupation> > </person> > </listPerson></body></text></TEI> > </items> > </xf:instance> > <xf:submission id="save" method="put" action="listperson.xml" replace="none"/> > <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> > <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> > </xf:submission> > </xf:model> > > </head> > <body> > <xf:group> > <label>why does this not work?</label> > > <xf:input ref="forename"><label>Forename</label></xf:input> > <xf:input ref="surname"><label>Surname></label></xf:input> > > </xf:group> > <xf:trigger> > <xf:label>New</xf:label> > <xf:action ev:event="DOMActivate"> > <xf:insert context="/items" origin="instance('template')/person" nodeset="persName" position="after" at="count(persName)"/> > </xf:action> > </xf:trigger> > <xf:submit submission="s01"> > <xf:label>View</xf:label> > </xf:submit> > </body> > </html> > <c709c5ba.png> > > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support |
From: Ralph C. <ra...@ra...> - 2021-02-10 18:32:25
|
Hi, Apologies for this as I'm sure that I'm missing something extremely basic, but I'm having problems with implementing Xsltforms running via an Apache server on a Synology NAS (for now). I'm totally new to Xforms (in any implementation) but have been working with TEI xml and fetchXML for a couple of years, so I'm comfortable with that side of things. All of the test forms downloaded with the implementation work fine - they have no problems at all. However, apparently simple changes cause the form to either not render at all (without error message) or with key parts missing. In the following example, I've changed some bits of Steve Pemberton's 'todo.xml'. This form is a partial success in that the form does render, and the s01 submission demonstrates that the src xml has been found and read. However, the input fields (and I've deliberately kept this short after the full model failed) do not appear (see image). There are no errors in the trace log and the profiler recognises that the 2 input fields exist. They just aren't being displayed. This problem is happening on all the examples I modify - I would understand it (more) if the triggers failed as I'm new to this, but failing to even render input/label seems really odd (and suggests that I'm making a very basic error)! Any help gratefully received Ralph <?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?> <?xsltforms-options debug="yes"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <head> <title> New Person</title> <xf:model> <xf:instance src="listPerson.xml [1]"/> <xf:instance id="template"> <items xmlns=""> <TEI><text><body><listPerson> <person> <persName><forename>Forename</forename><surname>Surname</surname></persName> <occupation><rolename></rolename></occupation> </person> </listPerson></body></text></TEI> </items> </xf:instance> <xf:submission id="save" method="put" action="listperson.xml" replace="none"/> <xf:submission id="s01" method="post" show="new" replace="all" action="xsltforms/txs.php?exec=beautify.txs"> <xf:message level="modeless" ev:event="xforms-submit-error">Submit error.</xf:message> </xf:submission> </xf:model> </head> <body> <xf:group> <label>why does this not work?</label> <xf:input ref="forename"><label>Forename</label></xf:input> <xf:input ref="surname"><label>Surname></label></xf:input> </xf:group> <xf:trigger> <xf:label>New</xf:label> <xf:action ev:event="DOMActivate"> <xf:insert context="/items" origin="instance('template')/person" nodeset="persName" position="after" at="count(persName)"/> </xf:action> </xf:trigger> <xf:submit submission="s01"> <xf:label>View</xf:label> </xf:submit> </body> </html> Links: ------ [1] http://192.168.0.10/ralphy/xslt/listPerson.xml |
From: Josselin M. <mor...@gm...> - 2021-02-06 13:42:34
|
Hi Steven, Hi Alain, I made a short and simple sample to show you how my form works, what it does, and the error I get with the submission. Because I run it with BaseX, I added a little Xquery script that creates the db and allows the saving of the submissions. If you want to use it, just put the form file into basex/webapp/static folder and the Xquery file into basex/webapp/ folder. It is a little REST application, just run basexhttp, then go to http://localhost:8984/xforms/install <http://localhost:8984/xforms/install> to create the db, and to http://localhost:8984/static/xsltforms/submissionLoop.xml <http://localhost:8984/static/xsltforms/submissionLoop.xml> to access the form. You can access the files on my Github Gist : https://gist.github.com/sardinecan/64451cf122095178159804e1ea13b4e5 <https://gist.github.com/sardinecan/64451cf122095178159804e1ea13b4e5> As you’ll see, I have two submissions, one for the added persons, which is looping as long as there are new persons, and a second one for the main instance which is running when all the new persons have been submitted. I use the dispatch method, with the xforms-submit-done event, and a @delay : <xf:action ev:event="xforms-submit-done"> <xf:dispatch name="submission" targetid="model" delay="1"/> </xf:action> Then I have a "if" rule to select the submission to run : <xf:action ev:event="submission"> <xf:send if="instance('sub')/xpr:person[@localType='new']" submission="submitNewPerson"/> <xf:send if="not(instance('sub')/xpr:person[@localType='new'])" submission="submitBio"/> </xf:action> Like Steven suggests, I think now that there is a submission activated twice, as the submission#submitBio is running two time and it shouldn’t, but maybe I’m doing something wrong ? Thanks a lot for your help, Best, Josselin. > Le 5 févr. 2021 à 10:54, Steven Pemberton <ste...@cw...> a écrit : > > Although submissions are by default asynchronous, a submission element may only be activated once at a time. I'm surprised that all the event values are empty; they really shouldn't be for an xforms-submit-error event. > > There is a difference in semantics between a dispatch with and without a delay, even if the delay is 0, so try making the delay 0, it should still work. The fact that it works with my original dispatch method suggests that the problem is indeed with a submission being activated twice, but my reading of the spec is that it should be possible once submit-done has been dispatched. I will raise this with the working group. > > Best wishes, > > Steven > > On Thursday 04 February 2021 23:42:37 (+01:00), Josselin Morvan wrote: > > Hi Steven, > > Thank you for your quick response. Unfortunately, all the error events are empty. > So, I tried your method with the dispatch element. At first it didn’t work either, then I added a delay to the dispatch and… it works! > As I said, when the submission is done, I update my instance with the server’s response (@xml:id and @localType value, etc.) and then I perform the next submission, maybe all these actions are asynchronous or performed simultaneously, and it produces a conflict? The @delay would allow to really execute the next submission at the end of the entire process? > > Best, > Josselin. > >> Le 4 févr. 2021 à 22:25, Steven Pemberton <ste...@cw... <mailto:ste...@cw...>> a écrit : >> >> <message>Submission error. >> error-type: <output value="event('error-type')"/> >> error-message: <output value="event('error-message')"/> >> response-status-code: <output value="event('response-status-code')"/> >> response-reason-phrase: <output value="event('response-reason-phrase')"/> >> resource-uri: <output value="event('resource-uri')"/> >> </message> > > > -- |
From: Josselin M. <mor...@gm...> - 2021-02-05 11:30:54
|
That was the error message I had 2 years ago “submission-in-progress“, and then I switched to my "while loop" and modified my submission routine to avoid this issue. I also checked my message element and it seems to be in the good place, in my <xf:submission /> I have : <xf:action ev:event="xforms-submit-error"> <xf:message level="modal"> error: error-type: <output value="event('error-type')"/> error-message: <output value="event('error-message')"/> response-status-code: <output value="event('response-status-code')"/> response-reason-phrase: <output value="event('response-reason-phrase')"/> resource-uri: <output value="event('resource-uri')"/> </xf:message> </xf:action> But I just tried it and I noticed that I get the error messages with the submission for my main instance, but not with the submission for my secondary instance (this one). Are you running XSLTForms 1.5? As you suggested, I also tried the dispatch method with @delay='0’ and it doesn’t work either, but with @delay=‘1' yes (before it was running with @delay='1000’)… I’ll make a sample, but the form is running with BaseX ant it’s quite big, I need to remove all unnecessary stuff to share it. Thank you very much for your help and sharing! Best, Josselin. > Le 5 févr. 2021 à 11:26, Steven Pemberton <ste...@cw...> a écrit : > > I added a test case to the XForms test suite to test for this case, and indeed XSLTForms incorrectly returns "submission-in-progress" if you do a <send/> in the handler for submit-done (apparently you put the message element in the wrong place). > > Steven > > On Thursday 04 February 2021 23:42:37 (+01:00), Josselin Morvan wrote: > > Hi Steven, > > Thank you for your quick response. Unfortunately, all the error events are empty. > So, I tried your method with the dispatch element. At first it didn’t work either, then I added a delay to the dispatch and… it works! > As I said, when the submission is done, I update my instance with the server’s response (@xml:id and @localType value, etc.) and then I perform the next submission, maybe all these actions are asynchronous or performed simultaneously, and it produces a conflict? The @delay would allow to really execute the next submission at the end of the entire process? > > Best, > Josselin. > >> Le 4 févr. 2021 à 22:25, Steven Pemberton <ste...@cw... <mailto:ste...@cw...>> a écrit : >> >> <message>Submission error. >> error-type: <output value="event('error-type')"/> >> error-message: <output value="event('error-message')"/> >> response-status-code: <output value="event('response-status-code')"/> >> response-reason-phrase: <output value="event('response-reason-phrase')"/> >> resource-uri: <output value="event('resource-uri')"/> >> </message> > > > -- |
From: Steven P. <ste...@cw...> - 2021-02-05 11:20:59
|
On Thursday 04 February 2021 15:34:27 (+01:00), Josselin Morvan wrote: Hi Steven, Thank you very much for your answer. I don't know why I didn’t think of it before, as I use this method with another form… but not for a loop. It’s simple and efficient! Just for my personal understanding, do you know (or anyone else) how works ev:defaultAction and if it’s fully implemented with XSLTforms? <xf:action ev:event="xforms-submit-error" ev:defaultAction="cancel"> <xf:send submission="submitNewEntity"/> </xf:action> What this says is: catch xforms-submit-error, and cancel its default action. However, if you look at https://www.w3.org/TR/xforms11/#submit-evt-submit-error or https://homepages.cwi.nl/~steven/xforms/xforms11-qr.html#XForms1 you'll see that you can't cancel it, because it has no default action. This is the case for all notification events: they have no default action. I'll add a test case to the TestSuite for ev:defaultAction though. Steven Thanks a lot, Best, Josselin. Le 4 févr. 2021 à 12:12, Steven Pemberton <ste...@cw...> a écrit : I was initially too lazy to check if a handler for submit-done was allowed to initiate a submission using the same submission element, but then my shame got the better of me and I looked it up. It is, so this is better (and I also added the necessary if= that I forgot to add): <submission id="submitNewEntity" blabla> <action ev:event="xforms-submit-done"> <send if="instance('xprEntities')/xpr:entity[@localType = 'new']" submission="submitNewEntity"/> </action> </submission> <trigger> <label>save</label> <action ev:event="DOMActivate"> <send submission="submitNewEntity"/> </action> </trigger> Steven On Thursday 04 February 2021 11:58:49 (+01:00), Steven Pemberton wrote: One way would be to submit just one, and let the xforms-submit-done event handler initiate the next. <submission id="submitNewEntity" blabla> <action ev:event="xforms-submit-done"> <dispatch name="NEXT" targetid="M"/> </action> </submission> <action ev:event="NEXT"> <send submission="submitNewEntity"/> </action> <trigger> <label>save</label> <action ev:event="DOMActivate"> <send submission="submitNewEntity"/> </action> </trigger> Steven On Wednesday 03 February 2021 15:33:21 (+01:00), Josselin Morvan wrote: Hi all, With one of my forms I have a « submission loop » and I try, when I get an « xforms-submit-error », to stop the loop, do you know how we can do that ?. Basically, my form concerns a list of person. I can add informations about the existing ones and, of course, add new persons. Each « new person » is saved individually, and for this I use a loop : <xf:trigger> <xf:label>save</xf:label> <xf:action ev:event="DOMActivate" while="instance('xprEntities')/xpr:entity[@localType = 'new']"> <xf:send submission="submitNewEntity"/> </xf:action> </xf:trigger> When the submission is done, I update my instance with my server’s response and I change the @localType value to ’stored’, and then the loop submit the next entity. <xf:submission mode="synchronous" id="submitNewEntity" ref="instance('xprEntities')/xpr:entity[@localType='new'][1]/eac:eac-cpf" resource="/xpr/biographies/put" method="put" replace="none"> <xf:action ev:event="xforms-submit-done"> <xf:message level="modal">Entity Saved!</xf:message> <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:xforms-id)]/@xml:id" value="event('response-body')//xpr:id"/> <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/@localType" value="'stored'"/> <xf:delete nodeset="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/eac:eac-cpf"/> </xf:action> <xf:action ev:event="xforms-submit-error"> <xf:message level="modal">Error</xf:message> </xf:action> </xf:submission> Here is my issue, when an xforms-submit-error occurs, by example because the name is required and is not filled, I’d like to stop the submission loop. For now, it is looping endlessly, as the @localType of current entity won’t be modified until the submission will be done… I tried to use ev:defaultAction="cancel" with the xf:action in the save trigger but it doesn’t work and I think I don’t use it properly! <xf:trigger> <xf:label>save</xf:label> <xf:action ev:event="DOMActivate" while="instance('xprEntities')/xpr:entity[@localType = 'new']"> <xf:action ev:event="xforms-submit-error" ev:defaultAction="cancel"> <xf:send submission="submitNewEntity"/> </xf:action> </xf:action> </xf:trigger> (I also tried this on the xf:send without success). Do you have any idea to achieve this or how to use ev:defaultAction ? I know I could add an incrementation system in my loop, (adding +1 to an iterator instance when xforms-submit-done or xforms-submit-error occurs, and submitting the next entity with position() = instance(‘iterator’)), but I’d like to avoid this way of proceeding. Thanks a lot for you help, best, Josselin. -- -- |
From: Steven P. <ste...@cw...> - 2021-02-05 10:26:55
|
I added a test case to the XForms test suite to test for this case, and indeed XSLTForms incorrectly returns "submission-in-progress" if you do a <send/> in the handler for submit-done (apparently you put the message element in the wrong place). Steven On Thursday 04 February 2021 23:42:37 (+01:00), Josselin Morvan wrote: Hi Steven, Thank you for your quick response. Unfortunately, all the error events are empty. So, I tried your method with the dispatch element. At first it didn’t work either, then I added a delay to the dispatch and… it works! As I said, when the submission is done, I update my instance with the server’s response (@xml:id and @localType value, etc.) and then I perform the next submission, maybe all these actions are asynchronous or performed simultaneously, and it produces a conflict? The @delay would allow to really execute the next submission at the end of the entire process? Best, Josselin. Le 4 févr. 2021 à 22:25, Steven Pemberton <ste...@cw...> a écrit : <message>Submission error. error-type: <output value="event('error-type')"/> error-message: <output value="event('error-message')"/> response-status-code: <output value="event('response-status-code')"/> response-reason-phrase: <output value="event('response-reason-phrase')"/> resource-uri: <output value="event('resource-uri')"/> </message> -- |
From: Steven P. <ste...@cw...> - 2021-02-05 09:55:16
|
Although submissions are by default asynchronous, a submission element may only be activated once at a time. I'm surprised that all the event values are empty; they really shouldn't be for an xforms-submit-error event. There is a difference in semantics between a dispatch with and without a delay, even if the delay is 0, so try making the delay 0, it should still work. The fact that it works with my original dispatch method suggests that the problem is indeed with a submission being activated twice, but my reading of the spec is that it should be possible once submit-done has been dispatched. I will raise this with the working group. Best wishes, Steven On Thursday 04 February 2021 23:42:37 (+01:00), Josselin Morvan wrote: Hi Steven, Thank you for your quick response. Unfortunately, all the error events are empty. So, I tried your method with the dispatch element. At first it didn’t work either, then I added a delay to the dispatch and… it works! As I said, when the submission is done, I update my instance with the server’s response (@xml:id and @localType value, etc.) and then I perform the next submission, maybe all these actions are asynchronous or performed simultaneously, and it produces a conflict? The @delay would allow to really execute the next submission at the end of the entire process? Best, Josselin. Le 4 févr. 2021 à 22:25, Steven Pemberton <ste...@cw...> a écrit : <message>Submission error. error-type: <output value="event('error-type')"/> error-message: <output value="event('error-message')"/> response-status-code: <output value="event('response-status-code')"/> response-reason-phrase: <output value="event('response-reason-phrase')"/> resource-uri: <output value="event('resource-uri')"/> </message> -- |
From: Josselin M. <mor...@gm...> - 2021-02-04 22:43:00
|
Hi Steven, Thank you for your quick response. Unfortunately, all the error events are empty. So, I tried your method with the dispatch element. At first it didn’t work either, then I added a delay to the dispatch and… it works! As I said, when the submission is done, I update my instance with the server’s response (@xml:id and @localType value, etc.) and then I perform the next submission, maybe all these actions are asynchronous or performed simultaneously, and it produces a conflict? The @delay would allow to really execute the next submission at the end of the entire process? Best, Josselin. > Le 4 févr. 2021 à 22:25, Steven Pemberton <ste...@cw...> a écrit : > > <message>Submission error. > error-type: <output value="event('error-type')"/> > error-message: <output value="event('error-message')"/> > response-status-code: <output value="event('response-status-code')"/> > response-reason-phrase: <output value="event('response-reason-phrase')"/> > resource-uri: <output value="event('resource-uri')"/> > </message> |
From: Steven P. <ste...@cw...> - 2021-02-04 21:25:24
|
What error do you get? Hint, use: <submission resource="..." ...> <action ev:event="xforms-submit-error"> <message>Submission error. error-type: <output value="event('error-type')"/> error-message: <output value="event('error-message')"/> response-status-code: <output value="event('response-status-code')"/> response-reason-phrase: <output value="event('response-reason-phrase')"/> resource-uri: <output value="event('resource-uri')"/> </message> </action> </submission> Steven On Thursday 04 February 2021 19:23:25 (+01:00), Josselin Morvan wrote: Hi Steven, hi all, Unfortunately, when I use the last method (submission/action[@ev:event="xforms-submit-done"]/send) I get an error with the second submission. I don’t know why I have this error as everything seems OK and it works with the "iteration method" or with the "@while method (if all the required fields are filled of course for this last one). Actually it is an old form that I’m reviewing with the release of xsltforms 1.5 and I remember now why I was using the @while attribute. Do you have any idea why I get an error when I’m looping with xforms-submit-done ? Tomorrow I’ll try with dispatch and I’ll make a sample form to show you. Thanks a lot for your help, Best, Josselin Envoyé de mon iPhone Le 4 févr. 2021 à 15:34, Josselin Morvan <mor...@gm...> a écrit : Hi Steven, Thank you very much for your answer. I don't know why I didn’t think of it before, as I use this method with another form… but not for a loop. It’s simple and efficient! Just for my personal understanding, do you know (or anyone else) how works ev:defaultAction and if it’s fully implemented with XSLTforms? Thanks a lot, Best, Josselin. Le 4 févr. 2021 à 12:12, Steven Pemberton <ste...@cw...> a écrit : I was initially too lazy to check if a handler for submit-done was allowed to initiate a submission using the same submission element, but then my shame got the better of me and I looked it up. It is, so this is better (and I also added the necessary if= that I forgot to add): <submission id="submitNewEntity" blabla> <action ev:event="xforms-submit-done"> <send if="instance('xprEntities')/xpr:entity[@localType = 'new']" submission="submitNewEntity"/> </action> </submission> <trigger> <label>save</label> <action ev:event="DOMActivate"> <send submission="submitNewEntity"/> </action> </trigger> Steven On Thursday 04 February 2021 11:58:49 (+01:00), Steven Pemberton wrote: One way would be to submit just one, and let the xforms-submit-done event handler initiate the next. <submission id="submitNewEntity" blabla> <action ev:event="xforms-submit-done"> <dispatch name="NEXT" targetid="M"/> </action> </submission> <action ev:event="NEXT"> <send submission="submitNewEntity"/> </action> <trigger> <label>save</label> <action ev:event="DOMActivate"> <send submission="submitNewEntity"/> </action> </trigger> Steven On Wednesday 03 February 2021 15:33:21 (+01:00), Josselin Morvan wrote: Hi all, With one of my forms I have a « submission loop » and I try, when I get an « xforms-submit-error », to stop the loop, do you know how we can do that ?. Basically, my form concerns a list of person. I can add informations about the existing ones and, of course, add new persons. Each « new person » is saved individually, and for this I use a loop : <xf:trigger> <xf:label>save</xf:label> <xf:action ev:event="DOMActivate" while="instance('xprEntities')/xpr:entity[@localType = 'new']"> <xf:send submission="submitNewEntity"/> </xf:action> </xf:trigger> When the submission is done, I update my instance with my server’s response and I change the @localType value to ’stored’, and then the loop submit the next entity. <xf:submission mode="synchronous" id="submitNewEntity" ref="instance('xprEntities')/xpr:entity[@localType='new'][1]/eac:eac-cpf" resource="/xpr/biographies/put" method="put" replace="none"> <xf:action ev:event="xforms-submit-done"> <xf:message level="modal">Entity Saved!</xf:message> <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:xforms-id)]/@xml:id" value="event('response-body')//xpr:id"/> <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/@localType" value="'stored'"/> <xf:delete nodeset="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/eac:eac-cpf"/> </xf:action> <xf:action ev:event="xforms-submit-error"> <xf:message level="modal">Error</xf:message> </xf:action> </xf:submission> Here is my issue, when an xforms-submit-error occurs, by example because the name is required and is not filled, I’d like to stop the submission loop. For now, it is looping endlessly, as the @localType of current entity won’t be modified until the submission will be done… I tried to use ev:defaultAction="cancel" with the xf:action in the save trigger but it doesn’t work and I think I don’t use it properly! <xf:trigger> <xf:label>save</xf:label> <xf:action ev:event="DOMActivate" while="instance('xprEntities')/xpr:entity[@localType = 'new']"> <xf:action ev:event="xforms-submit-error" ev:defaultAction="cancel"> <xf:send submission="submitNewEntity"/> </xf:action> </xf:action> </xf:trigger> (I also tried this on the xf:send without success). Do you have any idea to achieve this or how to use ev:defaultAction ? I know I could add an incrementation system in my loop, (adding +1 to an iterator instance when xforms-submit-done or xforms-submit-error occurs, and submitting the next entity with position() = instance(‘iterator’)), but I’d like to avoid this way of proceeding. Thanks a lot for you help, best, Josselin. -- -- |
From: Josselin M. <mor...@gm...> - 2021-02-04 18:23:47
|
Hi Steven, hi all, Unfortunately, when I use the last method (submission/action[@ev:event="xforms-submit-done"]/send) I get an error with the second submission. I don’t know why I have this error as everything seems OK and it works with the "iteration method" or with the "@while method (if all the required fields are filled of course for this last one). Actually it is an old form that I’m reviewing with the release of xsltforms 1.5 and I remember now why I was using the @while attribute. Do you have any idea why I get an error when I’m looping with xforms-submit-done ? Tomorrow I’ll try with dispatch and I’ll make a sample form to show you. Thanks a lot for your help, Best, Josselin Envoyé de mon iPhone > Le 4 févr. 2021 à 15:34, Josselin Morvan <mor...@gm...> a écrit : > Hi Steven, > > Thank you very much for your answer. I don't know why I didn’t think of it before, as I use this method with another form… but not for a loop. > It’s simple and efficient! > > Just for my personal understanding, do you know (or anyone else) how works ev:defaultAction and if it’s fully implemented with XSLTforms? > > Thanks a lot, > Best, > Josselin. > > >> Le 4 févr. 2021 à 12:12, Steven Pemberton <ste...@cw...> a écrit : >> >> I was initially too lazy to check if a handler for submit-done was allowed to initiate a submission using the same submission element, but then my shame got the better of me and I looked it up. It is, so this is better (and I also added the necessary if= that I forgot to add): >> >> <submission id="submitNewEntity" blabla> >> <action ev:event="xforms-submit-done"> >> <send if="instance('xprEntities')/xpr:entity[@localType = 'new']" submission="submitNewEntity"/> >> </action> >> </submission> >> >> <trigger> >> <label>save</label> >> <action ev:event="DOMActivate"> >> <send submission="submitNewEntity"/> >> </action> >> </trigger> >> >> Steven >> >> On Thursday 04 February 2021 11:58:49 (+01:00), Steven Pemberton wrote: >> >> One way would be to submit just one, and let the xforms-submit-done event handler initiate the next. >> >> <submission id="submitNewEntity" blabla> >> <action ev:event="xforms-submit-done"> >> <dispatch name="NEXT" targetid="M"/> >> </action> >> </submission> >> >> <action ev:event="NEXT"> >> <send submission="submitNewEntity"/> >> </action> >> >> <trigger> >> <label>save</label> >> <action ev:event="DOMActivate"> >> <send submission="submitNewEntity"/> >> </action> >> </trigger> >> >> Steven >> >> On Wednesday 03 February 2021 15:33:21 (+01:00), Josselin Morvan wrote: >> >> Hi all, >> >> With one of my forms I have a « submission loop » and I try, when I get an « xforms-submit-error », to stop the loop, do you know how we can do that ?. >> >> Basically, my form concerns a list of person. I can add informations about the existing ones and, of course, add new persons. >> >> Each « new person » is saved individually, and for this I use a loop : >> >> <xf:trigger> >> <xf:label>save</xf:label> >> <xf:action >> ev:event="DOMActivate" >> while="instance('xprEntities')/xpr:entity[@localType = 'new']"> >> <xf:send submission="submitNewEntity"/> >> </xf:action> >> </xf:trigger> >> >> When the submission is done, I update my instance with my server’s response and I change the @localType value to ’stored’, and then the loop submit the next entity. >> >> <xf:submission mode="synchronous" >> id="submitNewEntity" >> ref="instance('xprEntities')/xpr:entity[@localType='new'][1]/eac:eac-cpf" >> resource="/xpr/biographies/put" >> method="put" >> replace="none"> >> <xf:action ev:event="xforms-submit-done"> >> <xf:message level="modal">Entity Saved!</xf:message> >> <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:xforms-id)]/@xml:id" >> value="event('response-body')//xpr:id"/> >> <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/@localType" >> value="'stored'"/> >> <xf:delete nodeset="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/eac:eac-cpf"/> >> </xf:action> >> <xf:action ev:event="xforms-submit-error"> >> <xf:message level="modal">Error</xf:message> >> </xf:action> >> </xf:submission> >> >> >> Here is my issue, when an xforms-submit-error occurs, by example because the name is required and is not filled, I’d like to stop the submission loop. For now, it is looping endlessly, as the @localType of current entity won’t be modified until the submission will be done… >> >> I tried to use ev:defaultAction="cancel" with the xf:action in the save trigger but it doesn’t work and I think I don’t use it properly! >> >> <xf:trigger> >> <xf:label>save</xf:label> >> <xf:action >> ev:event="DOMActivate" >> while="instance('xprEntities')/xpr:entity[@localType = 'new']"> >> <xf:action ev:event="xforms-submit-error" >> ev:defaultAction="cancel"> >> <xf:send submission="submitNewEntity"/> >> </xf:action> >> </xf:action> >> </xf:trigger> >> (I also tried this on the xf:send without success). >> >> Do you have any idea to achieve this or how to use ev:defaultAction ? >> >> I know I could add an incrementation system in my loop, (adding +1 to an iterator instance when xforms-submit-done or xforms-submit-error occurs, and submitting the next entity with position() = instance(‘iterator’)), but I’d like to avoid this way of proceeding. >> >> Thanks a lot for you help, best, >> Josselin. >> >> -- |
From: Josselin M. <mor...@gm...> - 2021-02-04 14:34:50
|
Hi Steven, Thank you very much for your answer. I don't know why I didn’t think of it before, as I use this method with another form… but not for a loop. It’s simple and efficient! Just for my personal understanding, do you know (or anyone else) how works ev:defaultAction and if it’s fully implemented with XSLTforms? Thanks a lot, Best, Josselin. > Le 4 févr. 2021 à 12:12, Steven Pemberton <ste...@cw...> a écrit : > > I was initially too lazy to check if a handler for submit-done was allowed to initiate a submission using the same submission element, but then my shame got the better of me and I looked it up. It is, so this is better (and I also added the necessary if= that I forgot to add): > > <submission id="submitNewEntity" blabla> > <action ev:event="xforms-submit-done"> > <send if="instance('xprEntities')/xpr:entity[@localType = 'new']" submission="submitNewEntity"/> > </action> > </submission> > > <trigger> > <label>save</label> > <action ev:event="DOMActivate"> > <send submission="submitNewEntity"/> > </action> > </trigger> > > Steven > > On Thursday 04 February 2021 11:58:49 (+01:00), Steven Pemberton wrote: > > One way would be to submit just one, and let the xforms-submit-done event handler initiate the next. > > <submission id="submitNewEntity" blabla> > <action ev:event="xforms-submit-done"> > <dispatch name="NEXT" targetid="M"/> > </action> > </submission> > > <action ev:event="NEXT"> > <send submission="submitNewEntity"/> > </action> > > <trigger> > <label>save</label> > <action ev:event="DOMActivate"> > <send submission="submitNewEntity"/> > </action> > </trigger> > > Steven > > On Wednesday 03 February 2021 15:33:21 (+01:00), Josselin Morvan wrote: > > Hi all, > > With one of my forms I have a « submission loop » and I try, when I get an « xforms-submit-error », to stop the loop, do you know how we can do that ?. > > Basically, my form concerns a list of person. I can add informations about the existing ones and, of course, add new persons. > > Each « new person » is saved individually, and for this I use a loop : > > <xf:trigger> > <xf:label>save</xf:label> > <xf:action > ev:event="DOMActivate" > while="instance('xprEntities')/xpr:entity[@localType = 'new']"> > <xf:send submission="submitNewEntity"/> > </xf:action> > </xf:trigger> > > When the submission is done, I update my instance with my server’s response and I change the @localType value to ’stored’, and then the loop submit the next entity. > > <xf:submission mode="synchronous" > id="submitNewEntity" > ref="instance('xprEntities')/xpr:entity[@localType='new'][1]/eac:eac-cpf" > resource="/xpr/biographies/put" > method="put" > replace="none"> > <xf:action ev:event="xforms-submit-done"> > <xf:message level="modal">Entity Saved!</xf:message> > <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:xforms-id)]/@xml:id" > value="event('response-body')//xpr:id"/> > <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/@localType" > value="'stored'"/> > <xf:delete nodeset="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/eac:eac-cpf"/> > </xf:action> > <xf:action ev:event="xforms-submit-error"> > <xf:message level="modal">Error</xf:message> > </xf:action> > </xf:submission> > > > Here is my issue, when an xforms-submit-error occurs, by example because the name is required and is not filled, I’d like to stop the submission loop. For now, it is looping endlessly, as the @localType of current entity won’t be modified until the submission will be done… > > I tried to use ev:defaultAction="cancel" with the xf:action in the save trigger but it doesn’t work and I think I don’t use it properly! > > <xf:trigger> > <xf:label>save</xf:label> > <xf:action > ev:event="DOMActivate" > while="instance('xprEntities')/xpr:entity[@localType = 'new']"> > <xf:action ev:event="xforms-submit-error" > ev:defaultAction="cancel"> > <xf:send submission="submitNewEntity"/> > </xf:action> > </xf:action> > </xf:trigger> > (I also tried this on the xf:send without success). > > Do you have any idea to achieve this or how to use ev:defaultAction ? > > I know I could add an incrementation system in my loop, (adding +1 to an iterator instance when xforms-submit-done or xforms-submit-error occurs, and submitting the next entity with position() = instance(‘iterator’)), but I’d like to avoid this way of proceeding. > > Thanks a lot for you help, best, > Josselin. > > -- |
From: Steven P. <ste...@cw...> - 2021-02-04 11:15:54
|
One way would be to submit just one, and let the xforms-submit-done event handler initiate the next. <submission id="submitNewEntity" blabla> <action ev:event="xforms-submit-done"> <dispatch name="NEXT" targetid="M"/> </action> </submission> <action ev:event="NEXT"> <send submission="submitNewEntity"/> </action> <trigger> <label>save</label> <action ev:event="DOMActivate"> <send submission="submitNewEntity"/> </action> </trigger> Steven On Wednesday 03 February 2021 15:33:21 (+01:00), Josselin Morvan wrote: Hi all, With one of my forms I have a « submission loop » and I try, when I get an « xforms-submit-error », to stop the loop, do you know how we can do that ?. Basically, my form concerns a list of person. I can add informations about the existing ones and, of course, add new persons. Each « new person » is saved individually, and for this I use a loop : <xf:trigger> <xf:label>save</xf:label> <xf:action ev:event="DOMActivate" while="instance('xprEntities')/xpr:entity[@localType = 'new']"> <xf:send submission="submitNewEntity"/> </xf:action> </xf:trigger> When the submission is done, I update my instance with my server’s response and I change the @localType value to ’stored’, and then the loop submit the next entity. <xf:submission mode="synchronous" id="submitNewEntity" ref="instance('xprEntities')/xpr:entity[@localType='new'][1]/eac:eac-cpf" resource="/xpr/biographies/put" method="put" replace="none"> <xf:action ev:event="xforms-submit-done"> <xf:message level="modal">Entity Saved!</xf:message> <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:xforms-id)]/@xml:id" value="event('response-body')//xpr:id"/> <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/@localType" value="'stored'"/> <xf:delete nodeset="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/eac:eac-cpf"/> </xf:action> <xf:action ev:event="xforms-submit-error"> <xf:message level="modal">Error</xf:message> </xf:action> </xf:submission> Here is my issue, when an xforms-submit-error occurs, by example because the name is required and is not filled, I’d like to stop the submission loop. For now, it is looping endlessly, as the @localType of current entity won’t be modified until the submission will be done… I tried to use ev:defaultAction="cancel" with the xf:action in the save trigger but it doesn’t work and I think I don’t use it properly! <xf:trigger> <xf:label>save</xf:label> <xf:action ev:event="DOMActivate" while="instance('xprEntities')/xpr:entity[@localType = 'new']"> <xf:action ev:event="xforms-submit-error" ev:defaultAction="cancel"> <xf:send submission="submitNewEntity"/> </xf:action> </xf:action> </xf:trigger> (I also tried this on the xf:send without success). Do you have any idea to achieve this or how to use ev:defaultAction ? I know I could add an incrementation system in my loop, (adding +1 to an iterator instance when xforms-submit-done or xforms-submit-error occurs, and submitting the next entity with position() = instance(‘iterator’)), but I’d like to avoid this way of proceeding. Thanks a lot for you help, best, Josselin. -- |
From: Steven P. <ste...@cw...> - 2021-02-04 11:13:05
|
I was initially too lazy to check if a handler for submit-done was allowed to initiate a submission using the same submission element, but then my shame got the better of me and I looked it up. It is, so this is better (and I also added the necessary if= that I forgot to add): <submission id="submitNewEntity" blabla> <action ev:event="xforms-submit-done"> <send if="instance('xprEntities')/xpr:entity[@localType = 'new']" submission="submitNewEntity"/> </action> </submission> <trigger> <label>save</label> <action ev:event="DOMActivate"> <send submission="submitNewEntity"/> </action> </trigger> Steven On Thursday 04 February 2021 11:58:49 (+01:00), Steven Pemberton wrote: One way would be to submit just one, and let the xforms-submit-done event handler initiate the next. <submission id="submitNewEntity" blabla> <action ev:event="xforms-submit-done"> <dispatch name="NEXT" targetid="M"/> </action> </submission> <action ev:event="NEXT"> <send submission="submitNewEntity"/> </action> <trigger> <label>save</label> <action ev:event="DOMActivate"> <send submission="submitNewEntity"/> </action> </trigger> Steven On Wednesday 03 February 2021 15:33:21 (+01:00), Josselin Morvan wrote: Hi all, With one of my forms I have a « submission loop » and I try, when I get an « xforms-submit-error », to stop the loop, do you know how we can do that ?. Basically, my form concerns a list of person. I can add informations about the existing ones and, of course, add new persons. Each « new person » is saved individually, and for this I use a loop : <xf:trigger> <xf:label>save</xf:label> <xf:action ev:event="DOMActivate" while="instance('xprEntities')/xpr:entity[@localType = 'new']"> <xf:send submission="submitNewEntity"/> </xf:action> </xf:trigger> When the submission is done, I update my instance with my server’s response and I change the @localType value to ’stored’, and then the loop submit the next entity. <xf:submission mode="synchronous" id="submitNewEntity" ref="instance('xprEntities')/xpr:entity[@localType='new'][1]/eac:eac-cpf" resource="/xpr/biographies/put" method="put" replace="none"> <xf:action ev:event="xforms-submit-done"> <xf:message level="modal">Entity Saved!</xf:message> <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:xforms-id)]/@xml:id" value="event('response-body')//xpr:id"/> <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/@localType" value="'stored'"/> <xf:delete nodeset="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/eac:eac-cpf"/> </xf:action> <xf:action ev:event="xforms-submit-error"> <xf:message level="modal">Error</xf:message> </xf:action> </xf:submission> Here is my issue, when an xforms-submit-error occurs, by example because the name is required and is not filled, I’d like to stop the submission loop. For now, it is looping endlessly, as the @localType of current entity won’t be modified until the submission will be done… I tried to use ev:defaultAction="cancel" with the xf:action in the save trigger but it doesn’t work and I think I don’t use it properly! <xf:trigger> <xf:label>save</xf:label> <xf:action ev:event="DOMActivate" while="instance('xprEntities')/xpr:entity[@localType = 'new']"> <xf:action ev:event="xforms-submit-error" ev:defaultAction="cancel"> <xf:send submission="submitNewEntity"/> </xf:action> </xf:action> </xf:trigger> (I also tried this on the xf:send without success). Do you have any idea to achieve this or how to use ev:defaultAction ? I know I could add an incrementation system in my loop, (adding +1 to an iterator instance when xforms-submit-done or xforms-submit-error occurs, and submitting the next entity with position() = instance(‘iterator’)), but I’d like to avoid this way of proceeding. Thanks a lot for you help, best, Josselin. -- |
From: Josselin M. <mor...@gm...> - 2021-02-03 14:33:42
|
Hi all, With one of my forms I have a « submission loop » and I try, when I get an « xforms-submit-error », to stop the loop, do you know how we can do that ?. Basically, my form concerns a list of person. I can add informations about the existing ones and, of course, add new persons. Each « new person » is saved individually, and for this I use a loop : <xf:trigger> <xf:label>save</xf:label> <xf:action ev:event="DOMActivate" while="instance('xprEntities')/xpr:entity[@localType = 'new']"> <xf:send submission="submitNewEntity"/> </xf:action> </xf:trigger> When the submission is done, I update my instance with my server’s response and I change the @localType value to ’stored’, and then the loop submit the next entity. <xf:submission mode="synchronous" id="submitNewEntity" ref="instance('xprEntities')/xpr:entity[@localType='new'][1]/eac:eac-cpf" resource="/xpr/biographies/put" method="put" replace="none"> <xf:action ev:event="xforms-submit-done"> <xf:message level="modal">Entity Saved!</xf:message> <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:xforms-id)]/@xml:id" value="event('response-body')//xpr:id"/> <xf:setvalue ref="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/@localType" value="'stored'"/> <xf:delete nodeset="instance('xprEntities')/xpr:entity[@xml:id=normalize-space(event('response-body')//xpr:id)]/eac:eac-cpf"/> </xf:action> <xf:action ev:event="xforms-submit-error"> <xf:message level="modal">Error</xf:message> </xf:action> </xf:submission> Here is my issue, when an xforms-submit-error occurs, by example because the name is required and is not filled, I’d like to stop the submission loop. For now, it is looping endlessly, as the @localType of current entity won’t be modified until the submission will be done… I tried to use ev:defaultAction="cancel" with the xf:action in the save trigger but it doesn’t work and I think I don’t use it properly! <xf:trigger> <xf:label>save</xf:label> <xf:action ev:event="DOMActivate" while="instance('xprEntities')/xpr:entity[@localType = 'new']"> <xf:action ev:event="xforms-submit-error" ev:defaultAction="cancel"> <xf:send submission="submitNewEntity"/> </xf:action> </xf:action> </xf:trigger> (I also tried this on the xf:send without success). Do you have any idea to achieve this or how to use ev:defaultAction ? I know I could add an incrementation system in my loop, (adding +1 to an iterator instance when xforms-submit-done or xforms-submit-error occurs, and submitting the next entity with position() = instance(‘iterator’)), but I’d like to avoid this way of proceeding. Thanks a lot for you help, best, Josselin. |