Clearly these are easy questions for you, but as I still can't understand why my submission problem wouldn't work, I tried with a simplier example :). Attached (hopefully) are all 3 files that you can try for yourself. I have a login.xhtml. User enter a firstname and a lastname and then presses enter. And the 2nd page, I would like to show all everything that is saved in the instance and also just the firstname & username. I see strangely this (for those who don't want to bother testing ^^) :
Why does "<xsl:copy-of select="doc('input:instance')//*" outputs all that ? What is the correct way to access to data that is instance ? <xforms:group ref="instance('help')"> Firstname: | <xsl:value-of select="//firstname"/> | Lastname: | <xsl:value-of select="//lastname"/> | </xforms:group>Why does above not work ? In the logs, you can see what happens when the user enters data. First an empty instance, then a 2nd one, then one with firstname update (because I enter a word for it), then username, then submit, then again all the instance with all the info. Is this the normal bahaviour? Thanks for your help page-flow.xml login.xhtml login.xsl logs.zip |
Administrator
|
From login.xhtml, you submit the "test" instance. This instance looks
like this: <form xmlns=""> <a> <firstname>hello</firstname> <lastname>world</lastname> <action/> </a> </form> Then login.xsl receives the above on the input:instance. You use xsl:copy-of to copy it into the body of your document, which explains why the content of the above is copied as is. Regarding outputting the individual firstname and lastname, use the following instead: <td align="left">Firstname: </td><td><xsl:value-of select="doc('input:instance')//firstname"/></td> <td align="left">Lastname: </td><td><xsl:value-of select="doc('input:instance')//lastname"/></td> You could also use XForms instead of XSLT to output the values. -Erik StephR wrote: > > Clearly these are easy questions for you, but as I still can't understand > why my submission problem wouldn't work, I tried with a simplier example :). > > Attached (hopefully) are all 3 files that you can try for yourself. I have a > login.xhtml. User enter a firstname and a lastname and then presses enter. > And the 2nd page, I would like to show all everything that is saved in the > instance and also just the firstname & username. > > I see strangely this (for those who don't want to bother testing ^^) : > > > <table border="1"> > <tr> > > <td colspan="4"> > <form> > > <firstname>hello</firstname> > <lastname>world</lastname> > <action>submit</action> > > </form> > > > <firstname>hello</firstname> > <lastname>world</lastname> > <action>submit</action> > > > <firstname>hello</firstname> > <lastname>world</lastname> > <action>submit</action> > </td> > > </tr> > </table> > <br> > <table border="1"> > <tr> > > <td align="left">Firstname: </td> > <td></td> > <td align="left">Lastname: </td> > <td></td></tr> > </table> > > Why does "<xsl:copy-of select="doc('input:instance')//*" outputs all that ? > What is the correct way to access to data that is instance ? > > <xforms:group ref="instance('help')"> > <td align="left">Firstname: </td><td><xsl:value-of > select="//firstname"/></td> > <td align="left">Lastname: </td><td><xsl:value-of > select="//lastname"/></td> > </xforms:group> > > Why does above not work ? > > In the logs, you can see what happens when the user enters data. First an > empty instance, then a 2nd one, then one with firstname update (because I > enter a word for it), then username, then submit, then again all the > instance with all the info. Is this the normal bahaviour? > > Thanks for your help > > > > http://www.nabble.com/file/p13629746/page-flow.xml page-flow.xml > http://www.nabble.com/file/p13629746/login.xhtml login.xhtml > http://www.nabble.com/file/p13629746/login.xsl login.xsl > http://www.nabble.com/file/p13629746/logs.zip logs.zip > -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Thanks Erik for your help.
Why doesn't <xsl:copy-of select="doc('input:instance')//*" /> give <form xmlns=""> <a> <firstname>hello</firstname> <lastname>world</lastname> <action/> </a> </form> but this : <form> <firstname>hello</firstname> <lastname>world</lastname> <action>submit</action> </form> <a> <firstname>hello</firstname> <lastname>world</lastname> <action>submit</action> </a> <firstname>hello</firstname> <lastname>world</lastname> <action>submit</action> -------------------------------- Still in my XSL file, if in my model I declare the instance : <xforms:model> <xforms:instance id="help" xmlns=""> <xi:include href="input:instance"/> </xforms:instance> </xforms:model> Why doesn't <xforms:group ref="instance('help')"> <td align="left">Lastname: </td><td><xsl:value-of select="//lastname"/></td> </xforms:group> work ? I reference to the instance "help", so why do I have to again put select="doc('input:instance')//lastname for it to work ? What's the point in copying the instance in the model in this case ? What am I doing wrong ? Thanks for your help! Steph Erik Bruchez a écrit : From login.xhtml, you submit the "test" instance. This instance looks like this: -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Stephane,
I think one reason you are having problems is that you are mixing XSLT and XForms. When you do this, you have to be aware that XSLT is applied first, as a pre-processing step, and then the XForms engine takes over. An example where things go wrong is this: <xforms:group ref="instance('help')"> <td align="left">Lastname: </td> <td><xsl:value-of select="//lastname"/></td> </xforms:group> XSLT is applied first. <xsl:value-of select="//lastname"/> applies to the main input document for XSLT, which in your case is empty. See the following for how to access the current XML submission: http://www.orbeon.com/ops/doc/reference-page-flow#accessing-submission For the XSLT stylesheet to access the XML submission, you need ot use doc('input:instance'): <xsl:value-of select="doc('input:instance')//lastname"/> After XSLT has run, you end up with the following markup which then reaches the XForms processor: <xforms:group ref="instance('help')"> <td align="left">Lastname: </td> <td>world</td> </xforms:group> You can see how your xforms:group above won't do much for you. I would strongly recommend you stick with XSLT only or XForms only for that page, unless you have a good reason to mix them both. -Erik Stephane Ruchet wrote: > Thanks Erik for your help. > > Why doesn't > > <xsl:copy-of select="doc('input:instance')//*" /> > > give > > <form xmlns=""> > <a> > <firstname>hello</firstname> > <lastname>world</lastname> > <action/> > </a> > </form> > > but this : > > <form> > <firstname>hello</firstname> > <lastname>world</lastname> > <action>submit</action> > </form> > > <a> > <firstname>hello</firstname> > <lastname>world</lastname> > <action>submit</action> > </a> > > <firstname>hello</firstname> > <lastname>world</lastname> > <action>submit</action> > > -------------------------------- > > Still in my XSL file, if in my model I declare the instance : > > <xforms:model> > <xforms:instance id="help" xmlns=""> > <xi:include href="input:instance"/> > </xforms:instance> > </xforms:model> > > Why doesn't > > <xforms:group ref="instance('help')"> > <td align="left">Lastname: </td><td><xsl:value-of > select="//lastname"/></td> > </xforms:group> > > work ? I reference to the instance "help", so why do I have to again put > select="doc('input:instance')//lastname for it to work ? What's the > point in copying the instance in the model in this case ? What am I > doing wrong ? > > Thanks for your help! > > Steph > > > > > Erik Bruchez a écrit : >> From login.xhtml, you submit the "test" instance. This instance looks >> like this: >> >> <form xmlns=""> >> <a> >> <firstname>hello</firstname> >> <lastname>world</lastname> >> <action/> >> </a> >> </form> >> >> Then login.xsl receives the above on the input:instance. You use >> xsl:copy-of to copy it into the body of your document, which explains >> why the content of the above is copied as is. >> >> Regarding outputting the individual firstname and lastname, use the >> following instead: >> >> <td align="left">Firstname: </td><td><xsl:value-of >> select="doc('input:instance')//firstname"/></td> >> <td align="left">Lastname: </td><td><xsl:value-of >> select="doc('input:instance')//lastname"/></td> >> >> You could also use XForms instead of XSLT to output the values. >> >> -Erik >> >> StephR wrote: >>> >>> Clearly these are easy questions for you, but as I still can't >>> understand >>> why my submission problem wouldn't work, I tried with a simplier >>> example :). >>> >>> Attached (hopefully) are all 3 files that you can try for yourself. I >>> have a >>> login.xhtml. User enter a firstname and a lastname and then presses >>> enter. >>> And the 2nd page, I would like to show all everything that is saved >>> in the >>> instance and also just the firstname & username. >>> >>> I see strangely this (for those who don't want to bother testing ^^) : >>> >>> <table border="1"> >>> <tr> >>> <td colspan="4"> >>> <form> >>> <firstname>hello</firstname> >>> <lastname>world</lastname> >>> <action>submit</action> >>> </form> >>> >>> <firstname>hello</firstname> >>> <lastname>world</lastname> >>> <action>submit</action> >>> <firstname>hello</firstname> >>> <lastname>world</lastname> >>> <action>submit</action> >>> </td> >>> </tr> >>> </table> >>> <br> >>> <table border="1"> >>> <tr> >>> <td align="left">Firstname: </td> >>> <td></td> >>> <td align="left">Lastname: </td> >>> <td></td></tr> >>> </table> >>> >>> Why does "<xsl:copy-of select="doc('input:instance')//*" outputs all >>> that ? >>> What is the correct way to access to data that is instance ? >>> >>> <xforms:group ref="instance('help')"> >>> <td align="left">Firstname: </td><td><xsl:value-of >>> select="//firstname"/></td> >>> <td align="left">Lastname: </td><td><xsl:value-of >>> select="//lastname"/></td> >>> </xforms:group> >>> >>> Why does above not work ? >>> In the logs, you can see what happens when the user enters data. >>> First an >>> empty instance, then a 2nd one, then one with firstname update >>> (because I >>> enter a word for it), then username, then submit, then again all the >>> instance with all the info. Is this the normal bahaviour? >>> Thanks for your help >>> >>> >>> >>> http://www.nabble.com/file/p13629746/page-flow.xml page-flow.xml >>> http://www.nabble.com/file/p13629746/login.xhtml login.xhtml >>> http://www.nabble.com/file/p13629746/login.xsl login.xsl >>> http://www.nabble.com/file/p13629746/logs.zip logs.zip >> >> -- Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |