Hey All,
I was trying to understand the "change-language" funktion in the forms- example(en/fr) but couldn´t get through it...=( Maybe someone could tell my if this could work: - I have: myApp/ ----> homepage ----------->/homeWithWelcome ----------->/oneSpecForms ----------->/secSpecForm Now I want a select1 to change the (label)language but it should of course change in the whole app... 1) I create one language-model that holds the language 2) I put on every page an select1 to change the language defined in 1 3) I create 2 xml files to hold the label in the specific language THX -- 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 |
Masen,
> Now I want a select1 to change the (label)language but it should of > course change in the whole app... > > 1) I create one language-model that holds the language > 2) I put on every page an select1 to change the language defined in 1 > 3) I create 2 xml files to hold the label in the specific language first, you will have to decide how to make the language selection persistent between the pages of your app. There are different ways, you could write the selection into the scope [1, 2] or save it into eXist. Then, you need a way to load the language file for the selected language. This could be done using an XPL that reads the persistent language selection (from eXist or using the scope generator), loads the language file respectively, and returns it. This could be done by a submission issued on the xforms-ready event. If the user changes the language, again a XPL could be called to: - make the new choice persistent - load the language file according to the new selection (this is the same as above, so the delegation processor could be used here). HTH florian [1] http://www.orbeon.com/ops/doc/processors-serializers#scope-serializer [2] http://www.orbeon.com/ops/doc/processors-generators#scope-generator -- 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 |
Hey,
thanks for your help!!! But I am a newbie and maybe you can help me step by step..? 1) I think I´ll try to store the selection into eXist. ----but how?---- Do I have to call a submission, when the selection1 was changed? 2) Is the xforms-ready-event used like in the book-cast example? I remember that it was used to load init data... Please, maybe you can give me something like a "to-do" list... THX!!!!!! Am 11.06.2008 um 10:31 schrieb Florian Schmitt: > Masen, > >> Now I want a select1 to change the (label)language but it should of >> course change in the whole app... >> 1) I create one language-model that holds the language >> 2) I put on every page an select1 to change the language defined in 1 >> 3) I create 2 xml files to hold the label in the specific language > > first, you will have to decide how to make the language selection > persistent between the pages of your app. There are different ways, > you could write the selection into the scope [1, 2] or save it into > eXist. > > Then, you need a way to load the language file for the selected > language. This could be done using an XPL that reads the persistent > language selection (from eXist or using the scope generator), loads > the language file respectively, and returns it. This could be done > by a submission issued on the xforms-ready event. > > If the user changes the language, again a XPL could be called to: > - make the new choice persistent > - load the language file according to the new selection (this is the > same as above, so the delegation processor could be used here). > > HTH > florian > > [1] http://www.orbeon.com/ops/doc/processors-serializers#scope-serializer > [2] http://www.orbeon.com/ops/doc/processors-generators#scope- > generator > > > > -- > 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 -- 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 |
Hey,
now I´m able to store the "language-selection" into a lang.xml file into eXist. But how can I make all my pages load this information? From the "forms" example I copied the following: <!-- XForms instance containing text resources --> <!--<xforms:instance id="resources-instance" src="/homepage/common/{doc('input:instance')/*/form-id}/en"--> <xforms:instance id="resources-instance" src="oxf:/apps/2604/homepage/common/res-en.xml" xxforms:readonly="false"/> The value in my lang.xml file is en (or "de" or "fr") and depending on that value I want res-en.xml to be loaded... Any help? Am 11.06.2008 um 11:10 schrieb Masen J:
-- 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 |
hi Masen,
> now I´m able to store the "language-selection" into a lang.xml file into > eXist. > But how can I make all my pages load this information? you could do the following (not tested): 1) add a empty lang-selection instance ("lang") and one for the labels ("labels") to your models; 2) load your lang file on xforms-ready into instance('lang'): <xforms:send ev:event="xforms-ready" submission="load-lang"> <!-- Placeholder for step 3 --> </xforms:send> <xforms:submission id="load-lang" serialization="none" method="get" action="/exist/rest/db/*<your-path>*/*<your lang selection file>*" replace="instance" instance="lang"/> 3) Let the language file load on xforms-submit-done into labels: <xforms:send ev:event="xforms-ready" submission="load-lang"> <xforms:send ev:event="xforms-submit-done" submission="load-labels"> </xforms:send> <xforms:submission id="load-labels" serialization="none" method="get" action="/exist/rest/db/*<your-path>*/res-{instance('lang')/*path*}.xml" replace="instance" instance="labels"/> You could bind the select1 control for the language to the element containing the selected language. Then you're able to react on xforms-value-changed to write the new selection into eXist (using REST PUT) and load the new labels file. HTH florian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
ui ui,
gonna try it and let you know! THX Am 11.06.2008 um 13:39 schrieb Florian Schmitt: > hi Masen, > >> now I´m able to store the "language-selection" into a lang.xml file >> into eXist. >> But how can I make all my pages load this information? > > you could do the following (not tested): > > 1) add a empty lang-selection instance ("lang") and one for the > labels ("labels") to your models; > > 2) load your lang file on xforms-ready into instance('lang'): > > <xforms:send ev:event="xforms-ready" submission="load-lang"> > <!-- Placeholder for step 3 --> > </xforms:send> > <xforms:submission id="load-lang" serialization="none" method="get" > action="/exist/rest/db/*<your-path>*/*<your lang selection file>*" > replace="instance" instance="lang"/> > > 3) Let the language file load on xforms-submit-done into labels: > > <xforms:send ev:event="xforms-ready" submission="load-lang"> > <xforms:send ev:event="xforms-submit-done" submission="load- > labels"> > </xforms:send> > <xforms:submission id="load-labels" serialization="none" > method="get" action="/exist/rest/db/*<your-path>*/res- > {instance('lang')/*path*}.xml" replace="instance" instance="labels"/> > > > You could bind the select1 control for the language to the element > containing the selected language. Then you're able to react on > xforms-value-changed to write the new selection into eXist (using > REST PUT) and load the new labels file. > > HTH > florian > > > > -- > You receive this message as a subscriber of the [hidden email] > mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws -- 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
|
BTW we have an xxforms:get-session-attribute() function in the nightly
builds, and we will be adding an xxforms:set-session-attribute() as well soon. This could help you I think if you want to use the user's session to store language and other application-global preferences. -Erik On Jun 11, 2008, at 2:08 PM, Masen J wrote: > ui ui, > gonna try it and let you know! > THX > Am 11.06.2008 um 13:39 schrieb Florian Schmitt: > >> hi Masen, >> >>> now I´m able to store the "language-selection" into a lang.xml >>> file into eXist. >>> But how can I make all my pages load this information? >> >> you could do the following (not tested): >> >> 1) add a empty lang-selection instance ("lang") and one for the >> labels ("labels") to your models; >> >> 2) load your lang file on xforms-ready into instance('lang'): >> >> <xforms:send ev:event="xforms-ready" submission="load-lang"> >> <!-- Placeholder for step 3 --> >> </xforms:send> >> <xforms:submission id="load-lang" serialization="none" method="get" >> action="/exist/rest/db/*<your-path>*/*<your lang selection file>*" >> replace="instance" instance="lang"/> >> >> 3) Let the language file load on xforms-submit-done into labels: >> >> <xforms:send ev:event="xforms-ready" submission="load-lang"> >> <xforms:send ev:event="xforms-submit-done" submission="load- >> labels"> >> </xforms:send> >> <xforms:submission id="load-labels" serialization="none" >> method="get" action="/exist/rest/db/*<your-path>*/res- >> {instance('lang')/*path*}.xml" replace="instance" instance="labels"/> >> >> >> You could bind the select1 control for the language to the element >> containing the selected language. Then you're able to react on >> xforms-value-changed to write the new selection into eXist (using >> REST PUT) and load the new labels file. >> >> HTH >> florian >> >> >> >> -- >> You receive this message as a subscriber of the [hidden email] >> mailing list. >> To unsubscribe: mailto:[hidden email] >> For general help: mailto:[hidden email]?subject=help >> OW2 mailing lists service home page: http://www.ow2.org/wws > > > -- > 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 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 |
Hello,
I tried what Florian wrote. It was almost working but still not 100%. When I change the language it is stored in exist and because of: <xforms:send ev:event="xforms-value-changed" submission="save-lang"/> <xforms:send ev:event="xforms-value-changed" submission="load-labels"/> it is immediately changed. So far so good. When I change the site my language-instance is load from the database because of <xforms:send ev:event="xforms-ready" submission="load-lang"> but my resources-instance is not updated... This does not seem to work: <xforms:send ev:event="xforms-ready" submission="load-lang"> <xforms:send ev:event="xforms-submit-done" submission="load-labels2"> </xforms:send> <xforms:submission id="load-labels2" serialization="none" method="get" action="http://localhost:8080/exist/rest/db/dictionary/common/res-{instance('language-instance')}.xml" replace="instance" instance="resources-instance"/> </xforms:send> But it´s exactly what I want to do...when the first submission is ready(load-lang)-->do the next one(load-labels) Does anyone know how to solve it? And I was wondering about the following scenario: If the language is stored in exist (right now) what does happen, when more than one user works on the app in the same time? Below the code that at least changed the labels on one site... THX to all your help!!!!!!!=) <xforms:model id="resources-model" <!-- instance containing current language --> <xforms:instance id="language-instance"> <language xmlns=""></language> </xforms:instance> <xforms:instance id="resources-instance" src="oxf:/apps/2604/homepage/common/res-en.xml" xxforms:readonly="false"/> <!-- Update language submission --> <xforms:send ev:event="xforms-ready" submission="load-lang"> <xforms:send ev:event="xforms-submit-done" submission="load-labels2"> </xforms:send> <xforms:submission id="load-labels2" serialization="none" method="get" action="http://localhost:8080/exist/rest/db/dictionary/common/res-{instance('language-instance')}.xml" replace="instance" instance="resources-instance"/> </xforms:send> <xforms:submission id="load-lang" serialization="none" method="get" action="http://localhost:8080/exist/rest/db/dictionary/common/lang.xml" replace="instance" instance="language-instance"/> <xforms:submission id="save-lang" serialization="none" ref="instance('language-instance')" resource="http://localhost:8080/exist/rest/db/dictionary/common/lang.xml" method="put" replace="none"/> <xforms:submission id="load-labels" serialization="none" method="get" action="http://localhost:8080/exist/rest/db/dictionary/common/res-{instance('language-instance')}.xml" replace="instance" instance="resources-instance"/> </xforms:model> -- 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
|
> <xforms:send ev:event="xforms-ready" submission="load-lang">
Your event handler for xforms-submit-done must be within the
> <xforms:send ev:event="xforms-submit-done" > submission="load-labels2"> > </xforms:send> > <xforms:submission id="load-labels2" serialization="none" > method="get" > action="http://localhost:8080/exist/rest/db/dictionary/common/res- > {instance('language-instance')}.xml" replace="instance" > instance="resources-instance"/> > </xforms:send> > > But it´s exactly what I want to do...when the first submission is > ready(load-lang)-->do the next one(load-labels) > > Does anyone know how to solve it? xforms:submission element, not within the first xforms:send. > And I was wondering about the following scenario: > If the language is stored in exist (right now) what does happen, > when more than one user works on the app in the same time? You obviously need preferences per user. One way is to use the session rather than eXist, unless you have user preferences in your application anyway (which will require authenticating the users, etc.). -Erik -- 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 |
In reply to this post by masjab-2
hi Masen,
> This does not seem to work: > <xforms:send ev:event="xforms-ready" submission="load-lang"> > <xforms:send ev:event="xforms-submit-done" submission="load-labels2"> > </xforms:send> > <xforms:submission id="load-labels2" serialization="none" method="get" > action="http://localhost:8080/exist/rest/db/dictionary/common/res-{instance('language-instance')}.xml" replace="instance" instance="resources-instance"/> > </xforms:send> you should check step by step: - is the event xforms-submit-done fired? - is the submission URI correct (especially, is the {instance('language-instance')} correctly replaced by the selected language? - what is the server response to that submission? - is the target instance replaced? > And I was wondering about the following scenario: > If the language is stored in exist (right now) what does happen, when > more than one user works on the app in the same time? i don't know whether eXist handles two write operations occurring (nearly) the same time, but most probably, the second user selection will overwrite the first one. So, if the language selection should work for multiple users, you will need to modify the solution. There are different ways to do this: - add user information to the selected language (one language file for all users); - create one prefs file for each user (multiple files, makes it possible to make other user preferences persistent, too); - use the session attributes functions mentioned by Eric (the preferable way in my opinion); - save the language selection in the session scope so it's session-specific (needs an XPL pipeline to make use of the scope serializer / generator). HTH florian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
In reply to this post by Erik Bruchez
> Your event handler for xforms-submit-done must be within the
> xforms:submission element, not within the first xforms:send. sorry, originally my mistake in the example code... florian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
don´t care about it...=)
Didn´t get it to work anyway =( I do have multiple users and they do authenticate via the tomcat security-constraint which gets it data from an mysql-database. This is because I had a Forum(JForum) and I wanted a consistent user- database...Now everyone who did successfully registered to the board is able to work with my webapp. I would love to do this language-change with the sessions because there is one more thing I need to do which works on session data... But as I told you, I am very new to all this and kind of "lost"... Is there any tutorial about "working with session data" or is there an example, that I can learn from? The only thing that is missing (right now) is that language-change and (as I´m building an online dictionary for philosophy) a way to store some words in a user-session (something like:"my words that I want to print...) Thank you so much for your help! -- 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 |
hi Masen,
> I would love to do this language-change with the sessions because there > is one more thing I need to do which works on session data... > But as I told you, I am very new to all this and kind of "lost"... > > Is there any tutorial about "working with session data" or is there an > example, that I can learn from? it's not very complicated to work with the scope serializer and generator to save and read data in /from the session scope. Here's an example for each of both processors: <!-- Write language selection into scope --> <p:processor name="oxf:scope-serializer"> <p:input name="config"> <config> <key>language</key> <scope>session</scope> <session-scope>application</session-scope> </config> </p:input> <p:input name="data" href="#language-selection" debug="lang-sel-in" /> </p:processor> --> <!-- Read language selection from scope --> <p:processor name="oxf:scope-generator"> <p:input name="config"> <config> <key>language</key> <scope>session</scope> <session-scope>application</session-scope> </config> </p:input> <p:output name="language-selection" ref="data" debug="lang-sel-out" /> </p:processor> Using these processors, you could create two xpl files, one for writing the language selection into the scope, the other to read the selection and load the appropriate language file: 1. write-lang.xpl has one input parameter for the instance with the language selection, and one output parameter for the instance with the labels in the selected language. It has two processors: a scope-serializer to write the instance with the language selection (as above) into the scope, and a pipeline processor to call the read-labels.xpl. This way, every time the language is written (changed), the labels instance gets refreshed. 2. read-labels.xpl has no input parameter and only one output parameter. Because it relies on the scope content, it doesn't depend on any input parameters and can be called either from another XPL file (as in our case) or "standalone", for example on page initialization with no preceding language selection. It has two processors as minimum: the scope-generator to read the selected language from scope, and a processor to read the appropriate xml file containing the label texts. Which processor to use here depends on where these files are available, in eXist, in the file system or somewhere else. To select the appropriate labels file, one could choose the p:choose / p:when elements, or use an xslt processor to create the URI depending on the selected language. This allows also to handle the case where there's no data in the scope, so a default language file can be returned. read-labels.xpl returns the appropriate labels file on his output. write-lang simply passes this output (that's available on the pipeline processor output) as his own output. Then you need a page flow entry for both pipelines, so that they are accessible for a submission: <!-- Set the selected language and return labels instance --> <page id="write-lang" path-info="/write-lang" view="/*path*/write-lang.xpl"/> <!-- Return labels instance --> <page id="read-labels" path-info="/read-labels" view="/*path*/read-lang.xpl"/> Now, if you have the following in your xforms page: <xforms:instance id="labels"> <labels /> </xforms:instance> <xforms:submission id="read-labels" ref="instance('labels')" method="get" action="/read-labels" replace="instance" /> <xforms:send ev:event="xforms-ready" submission="read-labels" /> you can let the XPL load your labels according to the XPL rules (scope-saved selection or default). To react on a language selection, you can submit the instance containing the selected language to the write-lang.xpl that returns the appropriate labels file: <xforms:submission id="change-lang" ref="instance('language')" method="get" action="/write-lang" instance="labels" replace="instance" /> There are surely many more possibilities and better solutions - for example, the code above allows for only one labels file for the complete OF application. If individual label files for each page should be served, it would be better to uncouple the read-labels from the write-lang, and to add an input parameter to read-labels where th xpl receives the page id for which it should return the labels. HTH florian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hey Florian,
ok, I think I need to read about the xpl and try some basic examples... Is it ok to ask you again tomorrow because after reading your mail everything sounded so easy. When I tried to start, I didn´t know where... Hope not to bother you too much but I don´t know what to do. THX -- 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 |
hi Masen,
> ok, I think I need to read about the xpl and try some basic examples... > Is it ok to ask you again tomorrow because after reading your mail > everything sounded so easy. > When I tried to start, I didn´t know where... > Hope not to bother you too much but I don´t know what to do. no problem - it's IMHO essential to know how to work with XPL pipelines when using Orbeon, so it's a good idea to look at some XPL examples. florian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
In reply to this post by fl.schmitt(ops-users)
Am 12.06.2008 um 12:40 schrieb Florian Schmitt: 1. write-lang.xpl has one input parameter for the instance with the language selection, and one output parameter for the instance with the labels in the selected language. is it possible that you meant : 1. write-lang.xpl has one input parameter for the instance with the language selection, and one input parameter for the instance with the labels in the selected language. -- 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 |
hi Masen,
>> 1. write-lang.xpl has one input parameter for the instance with the >> language selection, and one output parameter for the instance with the >> labels in the selected language. > is it possible that you meant : > 1. write-lang.xpl has one input parameter for the instance with the > language selection, and one input parameter for the instance with the > labels in the selected language. that depends on what that xpl should do. The original idea was that write-lang.xpl should have two functions: 1. to save the language selection; 2. to to read and return the language-specific labels file (delegated to the read-labels.xpl). To do this, there's no need for another input besides the language selection. Furthermore, as far as i know, when a XPL is called via the page flow, only one input can be feeded with a submission, so you can't make use of two inputs in this case. HTH florian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Dear Florian, I tried everything now but still no luck! The language-instance should be globally accessible(into a session-variable..). 1) I created one file called write-lang.xpl: <!-- Write language selection into scope --> <p:processor name="oxf:scope-serializer"> <p:input name="config"> <config> <key>language</key> <scope>session</scope> <session-scope>application</session-scope> </config> </p:input> <p:input name="data" href="#language-selection" debug="lang-sel-in" /> </p:processor> --> 2) I created one file called read-labels.xpl: <!-- Read language selection from scope --> <p:processor name="oxf:scope-generator"> <p:input name="config"> <config> <key>language</key> <scope>session</scope> <session-scope>application</session-scope> </config> </p:input> <p:output name="language-selection" ref="data" debug="lang-sel-out" /> </p:processor> 3) In my model-vew I inserted the following: <!-- Set the selected language and return labels instance --> <page id="write-lang" path-info="/2604/common/write-lang/" view="homepage/common/write-lang.xpl"/> <page id="write-lang" path-info="/2604/common/read-labels/" view="homepage/common/read-labels.xpl"/> I hope till now everything is right. But what should I do next? I wanted to make a resources-model that is included to every page with: <xforms:submission id="change-lang" ref="instance('language-instance')" method="get" action="write-lang" instance="resources-instance" replace="instance" /> In my xforms page: <xforms:select1 model="resources-model" ref="instance('language-instance')"> <xforms:item> <xforms:label>ENGLISH </xforms:label> <xforms:value>en</xforms:value> </xforms:item> <xforms:item> <xforms:label>DEUTSCH </xforms:label> <xforms:value>de</xforms:value> </xforms:item> <xforms:send ev:event="xforms-value-changed" submission="change-lang"/> </xforms:select1> But nothing happens...=( Did I understand this right: I) the submission in my page fires "change-lang". II) "change-lang" is in my resources-model and fires the write-lang.xpl III ----HOW CAN I CHECK THIS?---- Man, I´m so lost... -- 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 |
hi Masen,
> I tried everything now but still no luck! > The language-instance should be globally accessible(into a > session-variable..). > 1) I created one file called write-lang.xpl: > > <!-- Write language selection into scope --> > <p:processor name="oxf:scope-serializer"> > <p:input name="config"> > <config> > <key>language</key> > <scope>session</scope> > <session-scope>application</session-scope> > </config> > </p:input> > <p:input name="data" href="#language-selection" debug="lang-sel-in" /> > </p:processor> --> in- and outputs need to be declared. For example, the pdf-detail-view.xpl in the Government Forms example looks as follows: <?xml version="1.0" encoding="UTF-8"?> <p:pipeline xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:p="http://www.orbeon.com/oxf/pipeline"> <p:param name="instance" type="input" /> <p:param name="data" type="output" /> <p:processor name="oxf:xforms-submission"> <p:input name="submission"> <xforms:submission serialization="none" method="get" action="/exist/rest/db/orbeon/forms/{/*/form-id}/{/*/document-id}" /> </p:input> <p:input name="request" href="#instance" /> <p:output name="response" id="document" /> </p:processor> <p:processor name="oxf:pdf-template"> <p:input name="data" href="#document" /> <p:input name="model" href="#instance#xpointer(doc(concat('../forms/', /*/form-id, '/pdf-model.xml')))" /> <p:output name="data" ref="data" /> </p:processor> </p:pipeline> This XPL defines two parameters, one input "instance" and one output "data". And it contains two processors, one REST submission processor ([1], oxf:xforms-submission), and one PDF Template processor. The request input of the Submission processor is bound to the instance input: <p:input name="request" href="#instance" /> And the data input of the PDF Template processor is bound to the out put of the Submission processor: <p:input name="data" href="#document" /> corresponding to the <p:output name="response" id="document" /> of the Submission processor. Please check the documentation how to connect the processors to in- and outputs [2]. The code snippets in my posting from yesterday were not complete XPL files, only examples how the scope serializer and -generator looks like. There are more processors needed as i described yesterday, for example a pipeline pipeline processor to call the read-labels.xpl. There's a complete example for this processor i the documentation [3]. > 2) I created one file called read-labels.xpl: > <!-- Read language selection from scope --> > <p:processor name="oxf:scope-generator"> > <p:input name="config"> > <config> > <key>language</key> > <scope>session</scope> > <session-scope>application</session-scope> > </config> > </p:input> > <p:output name="language-selection" ref="data" debug="lang-sel-out" /> > </p:processor> file. You will need to implement additional processors to load the labels file depending on the language selection. > 3) In my model-vew I inserted the following: > <!-- Set the selected language and return labels instance --> > <page id="write-lang" path-info="/2604/common/write-lang/" > view="homepage/common/write-lang.xpl"/> > <page id="write-lang" path-info="/2604/common/read-labels/" > view="homepage/common/read-labels.xpl"/> Both page entries have the same id - this will cause trouble. AFAIK they need a unique id. > Did I understand this right: > I) the submission in my page fires "change-lang". correct > II) "change-lang" is in my resources-model and fires the write-lang.xpl correct - to make it a bit clearer: it sends the instance 'language-instance' to the write-lang.xpl. That xpl saves it into the scope (scope-serializer) and calls the read-label.xpl (pipeline processor). > III ----HOW CAN I CHECK THIS?---- I've added debug attributes to the processor outputs in my example: debug="lang-sel-out" and debug="lang-sel-in". In the logs, this should lead to corresponding log entries containing the output content. This is described in the debug processor doc [4]. Firstly, you should take a look at the structure of the XPL files and on the usage of the processors, especially how to connect them. HTH florian [1] http://www.orbeon.com/ops/doc/processors-submission [2] http://www.orbeon.com/ops/doc/reference-xpl-pipelines#d45e1121 [3] http://www.orbeon.com/ops/doc/processors-pipeline [4] http://www.orbeon.com/ops/doc/processors-other#debug-processor -- 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 |
Hey,
first thing: how many mails can I write before you'll kill me?(kiddin=)) I read everything but still I´m stuck! Maybe I start asking you step by step because otherwise I´m not gonna make it at all...=( The tried the bookcast-example with the atom feed...and slowly I´m making my way. If I have a xform that has an instance: <!-- instance containing current language --> <xforms:instance id="language-instance"> <language xmlns="">de</language> </xforms:instance> <xforms:instance id="labels" src="oxf:/apps/2604/homepage/common/res-en.xml" xxforms:readonly="false"/> 1) How can I store that value (just to understand that whole scope-thing) into a session scope? 2) My submission works, but the xpl file doesn´t... <xforms:submission id="change-lang" ref="instance('language-instance')" method="get" action="/2604/write-lang/" instance="labels" replace="instance" /> Please, I know this must be very easy but right now I´m lost. -- 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 |