Alright, I hope I'm missing something simple here.
Here's the situation. I have a form, that on submit, posts the instance XML to a page I have defined in my page-flow.
Essentially this page has an action defined that points to an XPL file. This XPL file takes in the instance does some database work, an XUPdate to change one element in the XML, and then outputs the XML (using the output parameter, not the XML Serializer, since that actually spits out the XML before my view is rendered.)
Then, on the view for this page that the other page submitted to, I'm trying to access this modified XML document through the input:instance using XInclude, but I can only seem to get the same document that was submitted previously, not the one that my XPL file has modified.
I've tried moving this XPL file to the model="" attribute of the page (since I'm doing a very similar thing before the submit), but I cannot make my view access the modified XML, it always tries to read in the submitted instance. Is there something simple that I'm not doing here?
note: I can't use replace="instance" on the submission in this situation.
Thanks for any help,
Jay -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
is your output decleration in your xpl referencing instance?
<p:param name="instance" type="output"/> Henrik On 8/23/06,
Jay Klehr <[hidden email]> wrote:
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Jay Klehr
Also, I usually use <p:param name="data" type="output"/> in the xpl and <xsl::copy-of select="/"/> in the instance decleration in the view.
Henrik
On 8/23/06, Jay Klehr <[hidden email]> wrote:
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Henrik, thanks for the help, I think I'm getting closer (btw, I tried both 'instance' and 'data' for the XPL output parameter and neither seemed to have an effect).
I followed some instructions in the OPS User guide about Actions and Results in the Page-flow. The page that accepts the submission is now performing the XPL action (that modifies the instance and returns XML), and then in that action's result element I'm doing a simple XSLT transformation. Here's the page definition: <page id="save" path-info="/save" view="thankyou.xsl" model="site-model.xpl"> <action action="save.xpl"> <result transform="oxf:xslt"> <root xml:base="input:instance" xsl:version="2.0"> <xsl:copy-of select="document('input:action')/root/*" /> </root> </result> </action> </page> In the thankyou.xsl view I'm able to reference this modified instance with XInclude and assign it as my xforms model, like so: <f:model> <f:instance id="root"> <xi:include href="input:instance"/> </f:instance> </f:model> Which works, I can do an xforms output on the modified element, and it's showing that it's changed. However, I can't make XSLT see that data. I've tried a number of variations of the following, but nothing is giving me any data. <xsl:value-of select="document('input:instance')/root/element" /> This particular XSL statement was working before, but wasn't returning the modified data. I tried using >xsl:copy-of select="/" /> as well, but that didn't work either. You'll notice that my page has a model being assigned to it as well, so I'm pretty sure I need the document() stuff in the select to be able to get at the data I want. Why can I access this instance with XInclude but not XSL? Is there something I can do in my action/result setup that would make this work? Is there some XSL function that I overlooked? Thanks, Jay ________________________________ From: Henrik Pettersen [mailto:[hidden email]] Sent: Wed 8/23/2006 4:45 PM To: [hidden email] Subject: Re: [ops-users] Submission question, editing the instance before accessing it again Also, I usually use <p:param name="data" type="output"/> in the xpl and <xsl::copy-of select="/"/> in the instance decleration in the view. Henrik On 8/23/06, Jay Klehr <[hidden email]> wrote: Alright, I hope I'm missing something simple here. Here's the situation. I have a form, that on submit, posts the instance XML to a page I have defined in my page-flow. Essentially this page has an action defined that points to an XPL file. This XPL file takes in the instance does some database work, an XUPdate to change one element in the XML, and then outputs the XML (using the output parameter, not the XML Serializer, since that actually spits out the XML before my view is rendered.) Then, on the view for this page that the other page submitted to, I'm trying to access this modified XML document through the input:instance using XInclude, but I can only seem to get the same document that was submitted previously, not the one that my XPL file has modified. I've tried moving this XPL file to the model="" attribute of the page (since I'm doing a very similar thing before the submit), but I cannot make my view access the modified XML, it always tries to read in the submitted instance. Is there something simple that I'm not doing here? note: I can't use replace="instance" on the submission in this situation. Thanks for any help, Jay -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto: [hidden email] For general help: mailto: [hidden email] <mailto:[hidden email]> ?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws winmail.dat (11K) Download Attachment |
Hmmm.... Sometimes the combination of xforms and xslt can be a bit confusing. The trick here is to remember that the xslt only runs once, when the page is generated. Any subsequent changes to the instance will not modify a resource that has been rendered with xslt.
My advice would be to stick to xforms as much as possible. Instead of <xsl:value-of ...> or <xsl:copy-of, try using: <xforms:output ref="instance('root')/element"/> (double check that syntax...). I find that I miss xsl:if.... Hope that helps. Henrik On 8/24/06, Jay Klehr <[hidden email]> wrote: Henrik, thanks for the help, I think I'm getting closer (btw, I tried both 'instance' and 'data' for the XPL output parameter and neither seemed to have an effect). -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Henrik,
Yeah, that's the main reason I took this approach, because I wasn't able to use Xforms to get what I needed, and I couldn't use XSL because (like you said) it only applies on page load. The XSL should run in this situation since it's loading a new page after the submit (rather than replacing the instance, which is what I was doing before). I was able to get both Xforms and XSL seeing the same data before, but it wasn't the data that I modified first. Unfortunately, I can't use xforms:ouput in this situation because the bit of HTML I need to output can't be dynamically inserted into the page (it can, but it won't work as it's supposed to). So I need to do an XSL:if on the page load so the content gets rendered as part of the HTML DOM from the start. It must be possible! :) Jay ________________________________ From: Henrik Pettersen [mailto:[hidden email]] Sent: Wed 8/23/2006 8:25 PM To: [hidden email] Subject: Re: [ops-users] Submission question, editing the instance before accessing it again Hmmm.... Sometimes the combination of xforms and xslt can be a bit confusing. The trick here is to remember that the xslt only runs once, when the page is generated. Any subsequent changes to the instance will not modify a resource that has been rendered with xslt. My advice would be to stick to xforms as much as possible. Instead of <xsl:value-of ...> or <xsl:copy-of, try using: <xforms:output ref="instance('root')/element"/> (double check that syntax...). I find that I miss xsl:if.... Hope that helps. Henrik On 8/24/06, Jay Klehr <[hidden email]> wrote: Henrik, thanks for the help, I think I'm getting closer (btw, I tried both 'instance' and 'data' for the XPL output parameter and neither seemed to have an effect). I followed some instructions in the OPS User guide about Actions and Results in the Page-flow. The page that accepts the submission is now performing the XPL action (that modifies the instance and returns XML), and then in that action's result element I'm doing a simple XSLT transformation. Here's the page definition: <page id="save" path-info="/save" view="thankyou.xsl" model="site-model.xpl"> <action action="save.xpl"> <result transform="oxf:xslt"> <root xml:base="input:instance" xsl:version="2.0"> <xsl:copy-of select="document('input:action')/root/*" /> </root> </result> </action> </page> In the thankyou.xsl view I'm able to reference this modified instance with XInclude and assign it as my xforms model, like so: <f:model> <f:instance id="root"> <xi:include href="input:instance"/> </f:instance> </f:model> Which works, I can do an xforms output on the modified element, and it's showing that it's changed. However, I can't make XSLT see that data. I've tried a number of variations of the following, but nothing is giving me any data. <xsl:value-of select="document('input:instance')/root/element" /> This particular XSL statement was working before, but wasn't returning the modified data. I tried using >xsl:copy-of select="/" /> as well, but that didn't work either. You'll notice that my page has a model being assigned to it as well, so I'm pretty sure I need the document() stuff in the select to be able to get at the data I want. Why can I access this instance with XInclude but not XSL? Is there something I can do in my action/result setup that would make this work? Is there some XSL function that I overlooked? Thanks, Jay ________________________________ From: Henrik Pettersen [mailto:[hidden email]] Sent: Wed 8/23/2006 4:45 PM To: [hidden email] Subject: Re: [ops-users] Submission question, editing the instance before accessing it again Also, I usually use <p:param name="data" type="output"/> in the xpl and <xsl::copy-of select="/"/> in the instance decleration in the view. Henrik On 8/23/06, Jay Klehr <[hidden email]> wrote: Alright, I hope I'm missing something simple here. Here's the situation. I have a form, that on submit, posts the instance XML to a page I have defined in my page-flow. Essentially this page has an action defined that points to an XPL file. This XPL file takes in the instance does some database work, an XUPdate to change one element in the XML, and then outputs the XML (using the output parameter, not the XML Serializer, since that actually spits out the XML before my view is rendered.) Then, on the view for this page that the other page submitted to, I'm trying to access this modified XML document through the input:instance using XInclude, but I can only seem to get the same document that was submitted previously, not the one that my XPL file has modified. I've tried moving this XPL file to the model="" attribute of the page (since I'm doing a very similar thing before the submit), but I cannot make my view access the modified XML, it always tries to read in the submitted instance. Is there something simple that I'm not doing here? note: I can't use replace="instance" on the submission in this situation. Thanks for any help, Jay -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto: [hidden email] For general help: mailto: [hidden email] <mailto:[hidden email]> ?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto: [hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws winmail.dat (13K) Download Attachment |
Administrator
|
Jay,
> Unfortunately, I can't use xforms:ouput in this situation because > the bit of HTML I need to output can't be dynamically inserted into > the page (it can, but it won't work as it's supposed to). When using xforms:output/@mediatype="text/html", OPS now produces initial (X)HTML page with the (X)HTML directly embeeded within the page. If/when that HTML is updated dynamically, we use element.innerHTML from JavaScript. So this could work, no? -Erik -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Erik,
Thanks for the response. The problem with my situation, is that, this bit of HTML can't be in the HTML source until after the data has been modified (essentially that modification is setting a boolean value if this bit of HTML should be displayed or not). If it's in the HTML DOM before that check takes place, then it will incorrectly trigger an event. I've tried using xforms:output and my own custom JS function tied to a DOMActivate event, but then the event doesn't trigger as it should. That's why I had to resort to using a second page after the form submission, so that the check can be done when the page is rendered, and then the HTML is included if need be. Good news though, I was able to get it to work. I had to modify my page flow a bit, but now the XSL and Xforms see the same data and it's the right data. :) Jay ________________________________ From: Erik Bruchez on behalf of Erik Bruchez Sent: Thu 8/24/2006 5:55 PM To: [hidden email] Subject: Re: [ops-users] Submission question, editing the instance before accessing it again Jay, > Unfortunately, I can't use xforms:ouput in this situation because > the bit of HTML I need to output can't be dynamically inserted into > the page (it can, but it won't work as it's supposed to). When using xforms:output/@mediatype="text/html", OPS now produces initial (X)HTML page with the (X)HTML directly embeeded within the page. If/when that HTML is updated dynamically, we use element.innerHTML from JavaScript. So this could work, no? -Erik -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws winmail.dat (6K) Download Attachment |
Administrator
|
Jay,
I still don't understand, but I am glad you got it to work ;-) -Erik Jay Klehr wrote: > Erik, > > Thanks for the response. The problem with my situation, is that, this bit of HTML can't be in the HTML source until after the data has been modified (essentially that modification is setting a boolean value if this bit of HTML should be displayed or not). If it's in the HTML DOM before that check takes place, then it will incorrectly trigger an event. I've tried using xforms:output and my own custom JS function tied to a DOMActivate event, but then the event doesn't trigger as it should. That's why I had to resort to using a second page after the form submission, so that the check can be done when the page is rendered, and then the HTML is included if need be. > > Good news though, I was able to get it to work. I had to modify my page flow a bit, but now the XSL and Xforms see the same data and it's the right data. :) > > Jay > > ________________________________ > > From: Erik Bruchez on behalf of Erik Bruchez > Sent: Thu 8/24/2006 5:55 PM > To: [hidden email] > Subject: Re: [ops-users] Submission question, editing the instance before accessing it again > > > > Jay, > > > Unfortunately, I can't use xforms:ouput in this situation because > > the bit of HTML I need to output can't be dynamically inserted into > > the page (it can, but it won't work as it's supposed to). > > When using xforms:output/@mediatype="text/html", OPS now produces > initial (X)HTML page with the (X)HTML directly embeeded within the > page. If/when that HTML is updated dynamically, we use > element.innerHTML from JavaScript. So this could work, no? > > -Erik Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |