I'm trying to save a submitted Orbeon form to a file. The following xpl works perfectly.
But I would like to be able to name files dynamically. In here I just have a way to save in test.xml. How can I have something like test-xxx.xml with xxx the value of a field in my xml output? <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors"> <p:param name="instance" type="input"/> <p:processor name="oxf:xml-converter"> <p:input name="config"> <config> <encoding>utf-8</encoding> </config> </p:input> <p:input name="data" href="#instance"/> <p:output name="data" id="converted"/> </p:processor> <p:processor name="oxf:file-serializer"> <p:input name="config"> <config> <content-type>text/xml</content-type> <directory>c:/temp</directory> <file>test.xml</file> </config> </p:input> <p:input name="data" href="#converted"/> </p:processor> </p:config> -- This message was sent on behalf of [hidden email] at openSubscriber.com http://www.opensubscriber.com/messages/ops-users@.../topic.html -- 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 |
Sure. Just add a processor (like XSLT) to your xpl that will prepare
the config XML snippet for the oxf:file-serializer processor. A. On Nov 14, 2007, at 11:37 AM, [hidden email] wrote: > I'm trying to save a submitted Orbeon form to a file. The following > xpl works perfectly. > But I would like to be able to name files dynamically. In here I > just have a way to save in test.xml. How can I have something like > test-xxx.xml with xxx the value of a field in my xml output? > > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" > xmlns:oxf="http://www.orbeon.com/oxf/processors"> > > <p:param name="instance" type="input"/> > > <p:processor name="oxf:xml-converter"> > <p:input name="config"> > <config> > <encoding>utf-8</encoding> > </config> > </p:input> > <p:input name="data" href="#instance"/> > <p:output name="data" id="converted"/> > </p:processor> > > <p:processor name="oxf:file-serializer"> > <p:input name="config"> > <config> > <content-type>text/xml</content-type> > <directory>c:/temp</directory> > <file>test.xml</file> > </config> > </p:input> > <p:input name="data" href="#converted"/> > </p:processor> > > </p:config> > > > -- > This message was sent on behalf of [hidden email] at > openSubscriber.com > http://www.opensubscriber.com/messages/ops-users@.../ > topic.html > > -- > 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 |
Hello again,
Thank you very much Alexander for your prompt answer. I can see to process you describe but I experience difficulties in implementing it. I just began to work on pipelines yesterday... Do you have an example online that does such a thing? Or could you give me some? Thank you in advance. -- Mathieu FERRY Alexander Zatko <[hidden email] t> Pour [hidden email] 14/11/2007 12:00 cc PM [hidden email] Objet Re: [ops-users] Dynamic file name Veuillez in file serializer? répondre à [hidden email] g Sure. Just add a processor (like XSLT) to your xpl that will prepare the config XML snippet for the oxf:file-serializer processor. A. On Nov 14, 2007, at 11:37 AM, [hidden email] wrote: > I'm trying to save a submitted Orbeon form to a file. The following > xpl works perfectly. > But I would like to be able to name files dynamically. In here I > just have a way to save in test.xml. How can I have something like > test-xxx.xml with xxx the value of a field in my xml output? > > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" > xmlns:oxf="http://www.orbeon.com/oxf/processors"> > > <p:param name="instance" type="input"/> > > <p:processor name="oxf:xml-converter"> > <p:input name="config"> > <config> > <encoding>utf-8</encoding> > </config> > </p:input> > <p:input name="data" href="#instance"/> > <p:output name="data" id="converted"/> > </p:processor> > > <p:processor name="oxf:file-serializer"> > <p:input name="config"> > <config> > <content-type>text/xml</content-type> > <directory>c:/temp</directory> > <file>test.xml</file> > </config> > </p:input> > <p:input name="data" href="#converted"/> > </p:processor> > > </p:config> > > > -- > This message was sent on behalf of [hidden email] at > openSubscriber.com > http://www.opensubscriber.com/messages/ops-users@.../ > topic.html > > -- > 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 -- 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 Mathieu ,
Having the xslt stylesheet shown below, the file name produced will consist of word "data" + some string from the instance + current time + extension ".txt" All white spaces within the instance string and the current time string will be replaced by underscores. A. <!-- prepare config for the file-serializer --> <p:processor name="oxf:xslt"> <p:input name="data" href="#instance"/> <p:input name="path" href="#config"/> <p:input name="config"> <xsl:stylesheet version="2.0"> <xsl:template match="/"> <config> <directory> <xsl:value-of select="doc('input:path')/ config/write-path"/> </directory> <file> <xsl:value-of select="concat ('data',replace(/partno/ID-number,'\W','_'),substring(replace (xs:string(current-time()),'\W','_'), 1, 11),'.txt')"/> </file> <content-type>text/plain</content-type> <make-directories>true</make-directories> <encoding>utf-8</encoding> </config> </xsl:template> </xsl:stylesheet> </p:input> <p:output name="data" id="file-ser-config"/> </p:processor> <!-- write request to file --> <p:processor name="oxf:file-serializer"> <p:input name="data" href="#converted-output"/> <p:input name="config" href="#file-ser-config"/> </p:processor> On Nov 14, 2007, at 1:01 PM, [hidden email] wrote: > Hello again, > > Thank you very much Alexander for your prompt answer. I can see to > process > you describe but I experience difficulties in implementing it. I > just began > to work on pipelines yesterday... > > Do you have an example online that does such a thing? Or could you > give me > some? > > Thank you in advance. > > -- > Mathieu FERRY > > > > > Alexander Zatko > <[hidden email] > > t> Pour > [hidden email] > 14/11/2007 > 12:00 cc > PM [hidden email] > O > bjet > Re: [ops-users] Dynamic file > name > Veuillez in file serializer? > répondre à > [hidden email] > g > > > > > > > > Sure. Just add a processor (like XSLT) to your xpl that will prepare > the config XML snippet for the oxf:file-serializer processor. > > A. > > > On Nov 14, 2007, at 11:37 AM, [hidden email] wrote: > >> I'm trying to save a submitted Orbeon form to a file. The following >> xpl works perfectly. >> But I would like to be able to name files dynamically. In here I >> just have a way to save in test.xml. How can I have something like >> test-xxx.xml with xxx the value of a field in my xml output? >> >> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" >> xmlns:oxf="http://www.orbeon.com/oxf/processors"> >> >> <p:param name="instance" type="input"/> >> >> <p:processor name="oxf:xml-converter"> >> <p:input name="config"> >> <config> >> <encoding>utf-8</encoding> >> </config> >> </p:input> >> <p:input name="data" href="#instance"/> >> <p:output name="data" id="converted"/> >> </p:processor> >> >> <p:processor name="oxf:file-serializer"> >> <p:input name="config"> >> <config> >> <content-type>text/xml</content-type> >> <directory>c:/temp</directory> >> <file>test.xml</file> >> </config> >> </p:input> >> <p:input name="data" href="#converted"/> >> </p:processor> >> >> </p:config> >> >> >> -- >> This message was sent on behalf of [hidden email] at >> openSubscriber.com >> http://www.opensubscriber.com/messages/ops-users@.../ >> topic.html >> >> -- >> 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 > > > > -- > 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 |
Alexander,
Once again thank you for this support, you spare me some long time! After your first answer, I was pretty close from the solution bellow. But unfortunately I still cannot make it work. I cannot understand what is it I'm doing wrong. Thank you again. Best regards, ---testinstance.xml--- <?xml version="1.0" encoding="utf-8"?> <MonInstance xmlns:exforms="http://www.exforms.org/exf/1-0" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:widget="http://orbeon.org/oxf/xml/widget" xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms"> <Field1>Hello</Field1> <Field2>333</Field2> <Country>AF</Country> </MonInstance> ---save-file.xpl--- <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors"> <p:param name="instance" type="input"/> <p:processor name="oxf:xml-converter"> <p:input name="config"> <config> <encoding>utf-8</encoding> </config> </p:input> <p:input name="data" href="#instance"/> <p:output name="data" id="converted"/> </p:processor> <p:processor name="oxf:xslt"> <p:input name="data" href="#instance"/> <p:input name="config"> <xsl:stylesheet version="2.0"> <xsl:template match="/"> <config> <directory>c:/temp</directory> <file> <xsl:value-of select="concat('data',/MonInstance/Field2,substring(replace(xs:string(current-time()),'\W','_'), 1, 11),'.xml')"/> </file> <content-type>text/plain</content-type> <make-directories>true</make-directories> <encoding>utf-8</encoding> </config> </xsl:template> </xsl:stylesheet> </p:input> <p:output name="data" id="dyn-filename"/> </p:processor> <!-- write request to file --> <p:processor name="oxf:file-serializer"> <p:input name="data" href="#converted"/> <p:input name="config" href="#dyn-filename"/> </p:processor> </p:config> -- Mathieu FERRY Alexander Zatko <[hidden email] t> Pour [hidden email] 14/11/2007 01:35 cc PM Objet Re: Réf. : Re: [ops-users] Dynamic Veuillez file name in file serializer? répondre à [hidden email] g Hi Mathieu , Having the xslt stylesheet shown below, the file name produced will consist of word "data" + some string from the instance + current time + extension ".txt" All white spaces within the instance string and the current time string will be replaced by underscores. A. <!-- prepare config for the file-serializer --> <p:processor name="oxf:xslt"> <p:input name="data" href="#instance"/> <p:input name="path" href="#config"/> <p:input name="config"> <xsl:stylesheet version="2.0"> <xsl:template match="/"> <config> <directory> <xsl:value-of select="doc('input:path')/ config/write-path"/> </directory> <file> <xsl:value-of select="concat ('data',replace(/partno/ID-number,'\W','_'),substring(replace (xs:string(current-time()),'\W','_'), 1, 11),'.txt')"/> </file> <content-type>text/plain</content-type> <make-directories>true</make-directories> <encoding>utf-8</encoding> </config> </xsl:template> </xsl:stylesheet> </p:input> <p:output name="data" id="file-ser-config"/> </p:processor> <!-- write request to file --> <p:processor name="oxf:file-serializer"> <p:input name="data" href="#converted-output"/> <p:input name="config" href="#file-ser-config"/> </p:processor> On Nov 14, 2007, at 1:01 PM, [hidden email] wrote: > Hello again, > > Thank you very much Alexander for your prompt answer. I can see to > process > you describe but I experience difficulties in implementing it. I > just began > to work on pipelines yesterday... > > Do you have an example online that does such a thing? Or could you > give me > some? > > Thank you in advance. > > -- > Mathieu FERRY > > > > > Alexander Zatko > <[hidden email] > > t> Pour > [hidden email] > 14/11/2007 > 12:00 cc > PM [hidden email] > O > bjet > Re: [ops-users] Dynamic file > name > Veuillez in file serializer? > répondre à > [hidden email] > g > > > > > > > > Sure. Just add a processor (like XSLT) to your xpl that will prepare > the config XML snippet for the oxf:file-serializer processor. > > A. > > > On Nov 14, 2007, at 11:37 AM, [hidden email] wrote: > >> I'm trying to save a submitted Orbeon form to a file. The following >> xpl works perfectly. >> But I would like to be able to name files dynamically. In here I >> just have a way to save in test.xml. How can I have something like >> test-xxx.xml with xxx the value of a field in my xml output? >> >> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" >> xmlns:oxf="http://www.orbeon.com/oxf/processors"> >> >> <p:param name="instance" type="input"/> >> >> <p:processor name="oxf:xml-converter"> >> <p:input name="config"> >> <config> >> <encoding>utf-8</encoding> >> </config> >> </p:input> >> <p:input name="data" href="#instance"/> >> <p:output name="data" id="converted"/> >> </p:processor> >> >> <p:processor name="oxf:file-serializer"> >> <p:input name="config"> >> <config> >> <content-type>text/xml</content-type> >> <directory>c:/temp</directory> >> <file>test.xml</file> >> </config> >> </p:input> >> <p:input name="data" href="#converted"/> >> </p:processor> >> >> </p:config> >> >> >> -- >> This message was sent on behalf of [hidden email] at >> openSubscriber.com >> http://www.opensubscriber.com/messages/ops-users@.../ >> topic.html >> >> -- >> 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 > > > > -- > 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 -- 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 |
...and what problem are you seeing?
On Nov 14, 2007, at 2:29 PM, [hidden email] wrote: > Alexander, > > Once again thank you for this support, you spare me some long time! > After your first answer, I was pretty close from the solution bellow. > But unfortunately I still cannot make it work. I cannot understand > what is > it I'm doing wrong. > > Thank you again. > Best regards, > > ---testinstance.xml--- > <?xml version="1.0" encoding="utf-8"?> > <MonInstance xmlns:exforms="http://www.exforms.org/exf/1-0" > xmlns:xi="http://www.w3.org/2001/XInclude" > xmlns:widget="http://orbeon.org/oxf/xml/widget" > xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" > xmlns:f="http://orbeon.org/oxf/xml/formatting" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xforms="http://www.w3.org/2002/xforms"> > > <Field1>Hello</Field1> > <Field2>333</ > Field2> > <Country>AF</ > Country> > </MonInstance> > > ---save-file.xpl--- > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" > xmlns:oxf="http://www.orbeon.com/oxf/processors"> > > <p:param name="instance" type="input"/> > > <p:processor name="oxf:xml-converter"> > <p:input name="config"> > <config> > <encoding>utf-8</encoding> > </config> > </p:input> > <p:input name="data" href="#instance"/> > <p:output name="data" id="converted"/> > </p:processor> > > <p:processor name="oxf:xslt"> > <p:input name="data" href="#instance"/> > <p:input name="config"> > <xsl:stylesheet version="2.0"> > <xsl:template match="/"> > <config> > <directory>c:/temp</directory> > <file> > <xsl:value-of > select="concat('data',/MonInstance/Field2,substring(replace > (xs:string(current-time()),'\W','_'), > 1, 11),'.xml')"/> > </file> > <content-type>text/plain</content-type> > <make-directories>true</make-directories> > <encoding>utf-8</encoding> > </config> > </xsl:template> > </xsl:stylesheet> > </p:input> > <p:output name="data" id="dyn-filename"/> > </p:processor> > > <!-- write request to file --> > <p:processor name="oxf:file-serializer"> > <p:input name="data" href="#converted"/> > <p:input name="config" href="#dyn-filename"/> > </p:processor> > </p:config> > > > -- > Mathieu FERRY > > > > > Alexander Zatko > <[hidden email] > > t> Pour > [hidden email] > 14/11/2007 > 01:35 cc > PM > O > bjet > Re: Réf. : Re: [ops-users] > Dynamic > Veuillez file name in file serializer? > répondre à > [hidden email] > g > > > > > > > > Hi Mathieu , > > Having the xslt stylesheet shown below, the file name produced will > consist of word "data" + some string from the instance + current time > + extension ".txt" > > All white spaces within the instance string and the current time > string will be replaced by underscores. > > A. > > <!-- prepare config for the file-serializer --> > <p:processor name="oxf:xslt"> > <p:input name="data" href="#instance"/> > <p:input name="path" href="#config"/> > <p:input name="config"> > <xsl:stylesheet version="2.0"> > > <xsl:template match="/"> > <config> > <directory> > <xsl:value-of select="doc('input:path')/ > config/write-path"/> > </directory> > <file> > <xsl:value-of select="concat > ('data',replace(/partno/ID-number,'\W','_'),substring(replace > (xs:string(current-time()),'\W','_'), 1, 11),'.txt')"/> > </file> > <content-type>text/plain</content-type> > <make-directories>true</make-directories> > <encoding>utf-8</encoding> > </config> > </xsl:template> > > </xsl:stylesheet> > </p:input> > <p:output name="data" id="file-ser-config"/> > </p:processor> > > <!-- write request to file --> > <p:processor name="oxf:file-serializer"> > <p:input name="data" href="#converted-output"/> > <p:input name="config" href="#file-ser-config"/> > </p:processor> > > On Nov 14, 2007, at 1:01 PM, [hidden email] wrote: > >> Hello again, >> >> Thank you very much Alexander for your prompt answer. I can see to >> process >> you describe but I experience difficulties in implementing it. I >> just began >> to work on pipelines yesterday... >> >> Do you have an example online that does such a thing? Or could you >> give me >> some? >> >> Thank you in advance. >> >> -- >> Mathieu FERRY >> >> >> >> >> Alexander Zatko >> <[hidden email] >> >> t> Pour >> [hidden email] >> 14/11/2007 >> 12:00 cc >> PM [hidden email] >> >> O >> bjet >> Re: [ops-users] Dynamic file >> name >> Veuillez in file serializer? >> répondre à >> [hidden email] >> g >> >> >> >> >> >> >> >> Sure. Just add a processor (like XSLT) to your xpl that will prepare >> the config XML snippet for the oxf:file-serializer processor. >> >> A. >> >> >> On Nov 14, 2007, at 11:37 AM, [hidden email] wrote: >> >>> I'm trying to save a submitted Orbeon form to a file. The following >>> xpl works perfectly. >>> But I would like to be able to name files dynamically. In here I >>> just have a way to save in test.xml. How can I have something like >>> test-xxx.xml with xxx the value of a field in my xml output? >>> >>> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" >>> xmlns:oxf="http://www.orbeon.com/oxf/processors"> >>> >>> <p:param name="instance" type="input"/> >>> >>> <p:processor name="oxf:xml-converter"> >>> <p:input name="config"> >>> <config> >>> <encoding>utf-8</encoding> >>> </config> >>> </p:input> >>> <p:input name="data" href="#instance"/> >>> <p:output name="data" id="converted"/> >>> </p:processor> >>> >>> <p:processor name="oxf:file-serializer"> >>> <p:input name="config"> >>> <config> >>> <content-type>text/xml</content-type> >>> <directory>c:/temp</directory> >>> <file>test.xml</file> >>> </config> >>> </p:input> >>> <p:input name="data" href="#converted"/> >>> </p:processor> >>> >>> </p:config> >>> >>> >>> -- >>> This message was sent on behalf of [hidden email] at >>> openSubscriber.com >>> http://www.opensubscriber.com/messages/ops-users@.../ >>> topic.html >>> >>> -- >>> 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 >> >> >> >> -- >> 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 > > > > -- > 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 |
When I try to submit my form (a very simple form), I get the "An error
occured while saving!" message. If I deactivate xslt processor in the xpl (with a fixed filename), the submission is alright. I put the form source just to be sure: --8<-- <?xml version="1.0" encoding="utf-8"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:widget="http://orbeon.org/oxf/xml/widget" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:exforms="http://www.exforms.org/exf/1-0" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"> <head> <title>Test form</title> <!-- Definition of the data model for the form --> <xforms:model schema="/apps/formdev/testform.xsd"> <xforms:instance id="instance" xmlns=""> <MonInstance> <Field1></Field1> <Field2></Field2> </MonInstance> </xforms:instance> <xforms:submission ref="instance('instance')" id="save" method="post" action="/formdev/save" replace="none"> <xforms:message ev:event="xforms-submit-error" level="modal">An error occurred while saving!</xforms:message> </xforms:submission> </xforms:model> </head> <body> <table> <tr> <td>Field1:</td> <td><xforms:input ref="//MonInstance/Field1"/></td> <td>Field2:</td> <td><xforms:input ref="//MonInstance/Field2"/></td> </tr> <tr> <td> <xforms:submit submission="save"> <xforms:label>submit</xforms:label> </xforms:submit> </td> </tr> </table> </body> </html> -- Mathieu FERRY ABCnet: DFII/DSIN/SIDM/PMDG/AFMD Poste 45 55 22 (+33)(0) 1 61 45 55 22 Contact: [hidden email] ABCnet Teamroom GEVOLA Alexander Zatko <[hidden email] t> Pour [hidden email] 14/11/2007 02:38 cc PM Objet Re: Réf. : Re: Réf. : Re: Veuillez [ops-users] Dynamic file name in répondre à file serializer? [hidden email] g ...and what problem are you seeing? On Nov 14, 2007, at 2:29 PM, [hidden email] wrote: > Alexander, > > Once again thank you for this support, you spare me some long time! > After your first answer, I was pretty close from the solution bellow. > But unfortunately I still cannot make it work. I cannot understand > what is > it I'm doing wrong. > > Thank you again. > Best regards, > > ---testinstance.xml--- > <?xml version="1.0" encoding="utf-8"?> > <MonInstance xmlns:exforms="http://www.exforms.org/exf/1-0" > xmlns:xi="http://www.w3.org/2001/XInclude" > xmlns:widget="http://orbeon.org/oxf/xml/widget" > xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" > xmlns:f="http://orbeon.org/oxf/xml/formatting" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xforms="http://www.w3.org/2002/xforms"> > > <Field1>Hello</Field1> > <Field2>333</ > Field2> > <Country>AF</ > Country> > </MonInstance> > > ---save-file.xpl--- > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" > xmlns:oxf="http://www.orbeon.com/oxf/processors"> > > <p:param name="instance" type="input"/> > > <p:processor name="oxf:xml-converter"> > <p:input name="config"> > <config> > <encoding>utf-8</encoding> > </config> > </p:input> > <p:input name="data" href="#instance"/> > <p:output name="data" id="converted"/> > </p:processor> > > <p:processor name="oxf:xslt"> > <p:input name="data" href="#instance"/> > <p:input name="config"> > <xsl:stylesheet version="2.0"> > <xsl:template match="/"> > <config> > <directory>c:/temp</directory> > <file> > <xsl:value-of > select="concat('data',/MonInstance/Field2,substring(replace > (xs:string(current-time()),'\W','_'), > 1, 11),'.xml')"/> > </file> > <content-type>text/plain</content-type> > <make-directories>true</make-directories> > <encoding>utf-8</encoding> > </config> > </xsl:template> > </xsl:stylesheet> > </p:input> > <p:output name="data" id="dyn-filename"/> > </p:processor> > > <!-- write request to file --> > <p:processor name="oxf:file-serializer"> > <p:input name="data" href="#converted"/> > <p:input name="config" href="#dyn-filename"/> > </p:processor> > </p:config> > > > -- > Mathieu FERRY > > > > > Alexander Zatko > <[hidden email] > > t> Pour > [hidden email] > 14/11/2007 > 01:35 cc > PM > O > bjet > Re: Réf. : Re: [ops-users] > Dynamic > Veuillez file name in file serializer? > répondre à > [hidden email] > g > > > > > > > > Hi Mathieu , > > Having the xslt stylesheet shown below, the file name produced will > consist of word "data" + some string from the instance + current time > + extension ".txt" > > All white spaces within the instance string and the current time > string will be replaced by underscores. > > A. > > <!-- prepare config for the file-serializer --> > <p:processor name="oxf:xslt"> > <p:input name="data" href="#instance"/> > <p:input name="path" href="#config"/> > <p:input name="config"> > <xsl:stylesheet version="2.0"> > > <xsl:template match="/"> > <config> > <directory> > <xsl:value-of select="doc('input:path')/ > config/write-path"/> > </directory> > <file> > <xsl:value-of select="concat > ('data',replace(/partno/ID-number,'\W','_'),substring(replace > (xs:string(current-time()),'\W','_'), 1, 11),'.txt')"/> > </file> > <content-type>text/plain</content-type> > <make-directories>true</make-directories> > <encoding>utf-8</encoding> > </config> > </xsl:template> > > </xsl:stylesheet> > </p:input> > <p:output name="data" id="file-ser-config"/> > </p:processor> > > <!-- write request to file --> > <p:processor name="oxf:file-serializer"> > <p:input name="data" href="#converted-output"/> > <p:input name="config" href="#file-ser-config"/> > </p:processor> > > On Nov 14, 2007, at 1:01 PM, [hidden email] wrote: > >> Hello again, >> >> Thank you very much Alexander for your prompt answer. I can see to >> process >> you describe but I experience difficulties in implementing it. I >> just began >> to work on pipelines yesterday... >> >> Do you have an example online that does such a thing? Or could you >> give me >> some? >> >> Thank you in advance. >> >> -- >> Mathieu FERRY >> >> >> >> >> Alexander Zatko >> <[hidden email] >> >> t> Pour >> [hidden email] >> 14/11/2007 >> 12:00 cc >> PM [hidden email] >> >> O >> bjet >> Re: [ops-users] Dynamic file >> name >> Veuillez in file serializer? >> répondre à >> [hidden email] >> g >> >> >> >> >> >> >> >> Sure. Just add a processor (like XSLT) to your xpl that will prepare >> the config XML snippet for the oxf:file-serializer processor. >> >> A. >> >> >> On Nov 14, 2007, at 11:37 AM, [hidden email] wrote: >> >>> I'm trying to save a submitted Orbeon form to a file. The following >>> xpl works perfectly. >>> But I would like to be able to name files dynamically. In here I >>> just have a way to save in test.xml. How can I have something like >>> test-xxx.xml with xxx the value of a field in my xml output? >>> >>> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" >>> xmlns:oxf="http://www.orbeon.com/oxf/processors"> >>> >>> <p:param name="instance" type="input"/> >>> >>> <p:processor name="oxf:xml-converter"> >>> <p:input name="config"> >>> <config> >>> <encoding>utf-8</encoding> >>> </config> >>> </p:input> >>> <p:input name="data" href="#instance"/> >>> <p:output name="data" id="converted"/> >>> </p:processor> >>> >>> <p:processor name="oxf:file-serializer"> >>> <p:input name="config"> >>> <config> >>> <content-type>text/xml</content-type> >>> <directory>c:/temp</directory> >>> <file>test.xml</file> >>> </config> >>> </p:input> >>> <p:input name="data" href="#converted"/> >>> </p:processor> >>> >>> </p:config> >>> >>> >>> -- >>> This message was sent on behalf of [hidden email] at >>> openSubscriber.com >>> http://www.opensubscriber.com/messages/ops-users@.../ >>> topic.html >>> >>> -- >>> 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 >> >> >> >> -- >> 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 > > > > -- > 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 -- 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 |
Not sure what your page flow files look like, but I re-constructed
your mini app. Try to deploy it from the attached zip archive containing the changed/added files for the "resources" folder at // tomcat/webapps/ops/WEB-INF/resources/. Please note that you should not replace the existing resources folder, just replace the page-flow and add the "mathew" folder as the archive shows them. A. On Nov 14, 2007, at 2:49 PM, [hidden email] wrote: > When I try to submit my form (a very simple form), I get the "An error > occured while saving!" message. If I deactivate xslt processor in > the xpl > (with a fixed filename), the submission is alright. > > > I put the form source just to be sure: > --8<-- > > <?xml version="1.0" encoding="utf-8"?> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:widget="http://orbeon.org/oxf/xml/widget" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:exforms="http://www.exforms.org/exf/1-0" > xmlns:xi="http://www.w3.org/2001/XInclude" > xmlns:f="http://orbeon.org/oxf/xml/formatting" > xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"> > <head> > <title>Test form</title> > <!-- Definition of the data model for the form --> > <xforms:model schema="/apps/formdev/testform.xsd"> > <xforms:instance id="instance" xmlns=""> > <MonInstance> > <Field1></ > Field1> > <Field2></ > Field2> > </MonInstance> > </xforms:instance> > <xforms:submission ref="instance('instance')" > id="save" method="post" action="/formdev/save" replace="none"> > <xforms:message > ev:event="xforms-submit-error" level="modal">An error occurred while > saving!</xforms:message> > </xforms:submission> > </xforms:model> > </head> > > <body> > <table> > <tr> > <td>Field1:</td> > <td><xforms:input ref="//MonInstance/Field1"/ > ></td> > <td>Field2:</td> > <td><xforms:input ref="//MonInstance/Field2"/ > ></td> > </tr> > <tr> > <td> > <xforms:submit submission="save"> > <xforms:label>submit</xforms:label> > </xforms:submit> > </td> > </tr> > </table> > </body> > </html> > > -- > Mathieu FERRY > ABCnet: DFII/DSIN/SIDM/PMDG/AFMD > Poste 45 55 22 > (+33)(0) 1 61 45 55 22 > Contact: [hidden email] > ABCnet Teamroom > GEVOLA > > > > > Alexander Zatko > <[hidden email] > > t> Pour > [hidden email] > 14/11/2007 > 02:38 cc > PM > O > bjet > Re: Réf. : Re: Réf. : Re: > Veuillez [ops-users] Dynamic file > name in > répondre à file serializer? > [hidden email] > g > > > > > > > > > ...and what problem are you seeing? > > > On Nov 14, 2007, at 2:29 PM, [hidden email] wrote: > >> Alexander, >> >> Once again thank you for this support, you spare me some long time! >> After your first answer, I was pretty close from the solution bellow. >> But unfortunately I still cannot make it work. I cannot understand >> what is >> it I'm doing wrong. >> >> Thank you again. >> Best regards, >> >> ---testinstance.xml--- >> <?xml version="1.0" encoding="utf-8"?> >> <MonInstance xmlns:exforms="http://www.exforms.org/exf/1-0" >> xmlns:xi="http://www.w3.org/2001/XInclude" >> xmlns:widget="http://orbeon.org/oxf/xml/widget" >> xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" >> xmlns:f="http://orbeon.org/oxf/xml/formatting" >> xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >> xmlns:xs="http://www.w3.org/2001/XMLSchema" >> xmlns:ev="http://www.w3.org/2001/xml-events" >> xmlns:xforms="http://www.w3.org/2002/xforms"> >> >> <Field1>Hello</Field1> >> <Field2>333</ >> Field2> >> <Country>AF</ >> Country> >> </MonInstance> >> >> ---save-file.xpl--- >> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" >> xmlns:oxf="http://www.orbeon.com/oxf/processors"> >> >> <p:param name="instance" type="input"/> >> >> <p:processor name="oxf:xml-converter"> >> <p:input name="config"> >> <config> >> <encoding>utf-8</encoding> >> </config> >> </p:input> >> <p:input name="data" href="#instance"/> >> <p:output name="data" id="converted"/> >> </p:processor> >> >> <p:processor name="oxf:xslt"> >> <p:input name="data" href="#instance"/> >> <p:input name="config"> >> <xsl:stylesheet version="2.0"> >> <xsl:template match="/"> >> <config> >> <directory>c:/temp</directory> >> <file> >> <xsl:value-of >> select="concat('data',/MonInstance/Field2,substring(replace >> (xs:string(current-time()),'\W','_'), >> 1, 11),'.xml')"/> >> </file> >> <content-type>text/plain</content-type> >> <make-directories>true</make-directories> >> <encoding>utf-8</encoding> >> </config> >> </xsl:template> >> </xsl:stylesheet> >> </p:input> >> <p:output name="data" id="dyn-filename"/> >> </p:processor> >> >> <!-- write request to file --> >> <p:processor name="oxf:file-serializer"> >> <p:input name="data" href="#converted"/> >> <p:input name="config" href="#dyn-filename"/> >> </p:processor> >> </p:config> >> >> >> -- >> Mathieu FERRY >> >> >> >> >> Alexander Zatko >> <[hidden email] >> >> t> Pour >> [hidden email] >> 14/11/2007 >> 01:35 cc >> PM >> >> O >> bjet >> Re: Réf. : Re: [ops-users] >> Dynamic >> Veuillez file name in file serializer? >> répondre à >> [hidden email] >> g >> >> >> >> >> >> >> >> Hi Mathieu , >> >> Having the xslt stylesheet shown below, the file name produced will >> consist of word "data" + some string from the instance + current time >> + extension ".txt" >> >> All white spaces within the instance string and the current time >> string will be replaced by underscores. >> >> A. >> >> <!-- prepare config for the file-serializer --> >> <p:processor name="oxf:xslt"> >> <p:input name="data" href="#instance"/> >> <p:input name="path" href="#config"/> >> <p:input name="config"> >> <xsl:stylesheet version="2.0"> >> >> <xsl:template match="/"> >> <config> >> <directory> >> <xsl:value-of select="doc('input:path')/ >> config/write-path"/> >> </directory> >> <file> >> <xsl:value-of select="concat >> ('data',replace(/partno/ID-number,'\W','_'),substring(replace >> (xs:string(current-time()),'\W','_'), 1, 11),'.txt')"/> >> </file> >> <content-type>text/plain</content-type> >> <make-directories>true</make-directories> >> <encoding>utf-8</encoding> >> </config> >> </xsl:template> >> >> </xsl:stylesheet> >> </p:input> >> <p:output name="data" id="file-ser-config"/> >> </p:processor> >> >> <!-- write request to file --> >> <p:processor name="oxf:file-serializer"> >> <p:input name="data" href="#converted-output"/> >> <p:input name="config" href="#file-ser-config"/> >> </p:processor> >> >> On Nov 14, 2007, at 1:01 PM, [hidden email] wrote: >> >>> Hello again, >>> >>> Thank you very much Alexander for your prompt answer. I can see to >>> process >>> you describe but I experience difficulties in implementing it. I >>> just began >>> to work on pipelines yesterday... >>> >>> Do you have an example online that does such a thing? Or could you >>> give me >>> some? >>> >>> Thank you in advance. >>> >>> -- >>> Mathieu FERRY >>> >>> >>> >>> >>> Alexander Zatko >>> <[hidden email] >>> >>> t> Pour >>> [hidden email] >>> 14/11/2007 >>> 12:00 cc >>> PM [hidden email] >>> >>> O >>> bjet >>> Re: [ops-users] Dynamic file >>> name >>> Veuillez in file serializer? >>> répondre à >>> [hidden email] >>> g >>> >>> >>> >>> >>> >>> >>> >>> Sure. Just add a processor (like XSLT) to your xpl that will >>> prepare >>> the config XML snippet for the oxf:file-serializer processor. >>> >>> A. >>> >>> >>> On Nov 14, 2007, at 11:37 AM, [hidden email] wrote: >>> >>>> I'm trying to save a submitted Orbeon form to a file. The following >>>> xpl works perfectly. >>>> But I would like to be able to name files dynamically. In here I >>>> just have a way to save in test.xml. How can I have something like >>>> test-xxx.xml with xxx the value of a field in my xml output? >>>> >>>> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" >>>> xmlns:oxf="http://www.orbeon.com/oxf/processors"> >>>> >>>> <p:param name="instance" type="input"/> >>>> >>>> <p:processor name="oxf:xml-converter"> >>>> <p:input name="config"> >>>> <config> >>>> <encoding>utf-8</encoding> >>>> </config> >>>> </p:input> >>>> <p:input name="data" href="#instance"/> >>>> <p:output name="data" id="converted"/> >>>> </p:processor> >>>> >>>> <p:processor name="oxf:file-serializer"> >>>> <p:input name="config"> >>>> <config> >>>> <content-type>text/xml</content-type> >>>> <directory>c:/temp</directory> >>>> <file>test.xml</file> >>>> </config> >>>> </p:input> >>>> <p:input name="data" href="#converted"/> >>>> </p:processor> >>>> >>>> </p:config> >>>> >>>> >>>> -- >>>> This message was sent on behalf of [hidden email] at >>>> openSubscriber.com >>>> http://www.opensubscriber.com/messages/ops-users@.../ >>>> topic.html >>>> >>>> -- >>>> 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 >>> >>> >>> >>> -- >>> 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 >> >> >> >> -- >> 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 > > > > -- > 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 resources.zip (4K) Download Attachment |
My god this is working... Thank you Alexander. Now that I have a workgin
sample, I can work. Thank you very much for your support. Best regards, -- Mathieu FERRY ABCnet: DFII/DSIN/SIDM/PMDG/AFMD Poste 45 55 22 (+33)(0) 1 61 45 55 22 Contact: [hidden email] ABCnet Teamroom GEVOLA Alexander Zatko <[hidden email] t> Pour [hidden email] 14/11/2007 03:37 cc PM Objet Re: [ops-users] Dynamic file name Veuillez in file serializer? répondre à [hidden email] g Not sure what your page flow files look like, but I re-constructed your mini app. Try to deploy it from the attached zip archive containing the changed/added files for the "resources" folder at // tomcat/webapps/ops/WEB-INF/resources/. Please note that you should not replace the existing resources folder, just replace the page-flow and add the "mathew" folder as the archive shows them. A. [rattachement "resources.zip" supprimé par MATHIEU FERRY - U217690/users/PSA] On Nov 14, 2007, at 2:49 PM, [hidden email] wrote: > When I try to submit my form (a very simple form), I get the "An error > occured while saving!" message. If I deactivate xslt processor in > the xpl > (with a fixed filename), the submission is alright. > > > I put the form source just to be sure: > --8<-- > > <?xml version="1.0" encoding="utf-8"?> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:widget="http://orbeon.org/oxf/xml/widget" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:exforms="http://www.exforms.org/exf/1-0" > xmlns:xi="http://www.w3.org/2001/XInclude" > xmlns:f="http://orbeon.org/oxf/xml/formatting" > xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"> > <head> > <title>Test form</title> > <!-- Definition of the data model for the form --> > <xforms:model schema="/apps/formdev/testform.xsd"> > <xforms:instance id="instance" xmlns=""> > <MonInstance> > <Field1></ > Field1> > <Field2></ > Field2> > </MonInstance> > </xforms:instance> > <xforms:submission ref="instance('instance')" > id="save" method="post" action="/formdev/save" replace="none"> > <xforms:message > ev:event="xforms-submit-error" level="modal">An error occurred while > saving!</xforms:message> > </xforms:submission> > </xforms:model> > </head> > > <body> > <table> > <tr> > <td>Field1:</td> > <td><xforms:input ref="//MonInstance/Field1"/ > ></td> > <td>Field2:</td> > <td><xforms:input ref="//MonInstance/Field2"/ > ></td> > </tr> > <tr> > <td> > <xforms:submit submission="save"> > <xforms:label>submit</xforms:label> > </xforms:submit> > </td> > </tr> > </table> > </body> > </html> > > -- > Mathieu FERRY > ABCnet: DFII/DSIN/SIDM/PMDG/AFMD > Poste 45 55 22 > (+33)(0) 1 61 45 55 22 > Contact: [hidden email] > ABCnet Teamroom > GEVOLA > > > > > Alexander Zatko > <[hidden email] > > t> Pour > [hidden email] > 14/11/2007 > 02:38 cc > PM > O > bjet > Re: Réf. : Re: Réf. : Re: > Veuillez [ops-users] Dynamic file > name in > répondre à file serializer? > [hidden email] > g > > > > > > > > > ...and what problem are you seeing? > > > On Nov 14, 2007, at 2:29 PM, [hidden email] wrote: > >> Alexander, >> >> Once again thank you for this support, you spare me some long time! >> After your first answer, I was pretty close from the solution bellow. >> But unfortunately I still cannot make it work. I cannot understand >> what is >> it I'm doing wrong. >> >> Thank you again. >> Best regards, >> >> ---testinstance.xml--- >> <?xml version="1.0" encoding="utf-8"?> >> <MonInstance xmlns:exforms="http://www.exforms.org/exf/1-0" >> xmlns:xi="http://www.w3.org/2001/XInclude" >> xmlns:widget="http://orbeon.org/oxf/xml/widget" >> xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" >> xmlns:f="http://orbeon.org/oxf/xml/formatting" >> xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" >> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >> xmlns:xs="http://www.w3.org/2001/XMLSchema" >> xmlns:ev="http://www.w3.org/2001/xml-events" >> xmlns:xforms="http://www.w3.org/2002/xforms"> >> >> <Field1>Hello</Field1> >> <Field2>333</ >> Field2> >> <Country>AF</ >> Country> >> </MonInstance> >> >> ---save-file.xpl--- >> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" >> xmlns:oxf="http://www.orbeon.com/oxf/processors"> >> >> <p:param name="instance" type="input"/> >> >> <p:processor name="oxf:xml-converter"> >> <p:input name="config"> >> <config> >> <encoding>utf-8</encoding> >> </config> >> </p:input> >> <p:input name="data" href="#instance"/> >> <p:output name="data" id="converted"/> >> </p:processor> >> >> <p:processor name="oxf:xslt"> >> <p:input name="data" href="#instance"/> >> <p:input name="config"> >> <xsl:stylesheet version="2.0"> >> <xsl:template match="/"> >> <config> >> <directory>c:/temp</directory> >> <file> >> <xsl:value-of >> select="concat('data',/MonInstance/Field2,substring(replace >> (xs:string(current-time()),'\W','_'), >> 1, 11),'.xml')"/> >> </file> >> <content-type>text/plain</content-type> >> <make-directories>true</make-directories> >> <encoding>utf-8</encoding> >> </config> >> </xsl:template> >> </xsl:stylesheet> >> </p:input> >> <p:output name="data" id="dyn-filename"/> >> </p:processor> >> >> <!-- write request to file --> >> <p:processor name="oxf:file-serializer"> >> <p:input name="data" href="#converted"/> >> <p:input name="config" href="#dyn-filename"/> >> </p:processor> >> </p:config> >> >> >> -- >> Mathieu FERRY >> >> >> >> >> Alexander Zatko >> <[hidden email] >> >> t> Pour >> [hidden email] >> 14/11/2007 >> 01:35 cc >> PM >> >> O >> bjet >> Re: Réf. : Re: [ops-users] >> Dynamic >> Veuillez file name in file serializer? >> répondre à >> [hidden email] >> g >> >> >> >> >> >> >> >> Hi Mathieu , >> >> Having the xslt stylesheet shown below, the file name produced will >> consist of word "data" + some string from the instance + current time >> + extension ".txt" >> >> All white spaces within the instance string and the current time >> string will be replaced by underscores. >> >> A. >> >> <!-- prepare config for the file-serializer --> >> <p:processor name="oxf:xslt"> >> <p:input name="data" href="#instance"/> >> <p:input name="path" href="#config"/> >> <p:input name="config"> >> <xsl:stylesheet version="2.0"> >> >> <xsl:template match="/"> >> <config> >> <directory> >> <xsl:value-of select="doc('input:path')/ >> config/write-path"/> >> </directory> >> <file> >> <xsl:value-of select="concat >> ('data',replace(/partno/ID-number,'\W','_'),substring(replace >> (xs:string(current-time()),'\W','_'), 1, 11),'.txt')"/> >> </file> >> <content-type>text/plain</content-type> >> <make-directories>true</make-directories> >> <encoding>utf-8</encoding> >> </config> >> </xsl:template> >> >> </xsl:stylesheet> >> </p:input> >> <p:output name="data" id="file-ser-config"/> >> </p:processor> >> >> <!-- write request to file --> >> <p:processor name="oxf:file-serializer"> >> <p:input name="data" href="#converted-output"/> >> <p:input name="config" href="#file-ser-config"/> >> </p:processor> >> >> On Nov 14, 2007, at 1:01 PM, [hidden email] wrote: >> >>> Hello again, >>> >>> Thank you very much Alexander for your prompt answer. I can see to >>> process >>> you describe but I experience difficulties in implementing it. I >>> just began >>> to work on pipelines yesterday... >>> >>> Do you have an example online that does such a thing? Or could you >>> give me >>> some? >>> >>> Thank you in advance. >>> >>> -- >>> Mathieu FERRY >>> >>> >>> >>> >>> Alexander Zatko >>> <[hidden email] >>> >>> t> Pour >>> [hidden email] >>> 14/11/2007 >>> 12:00 cc >>> PM [hidden email] >>> >>> O >>> bjet >>> Re: [ops-users] Dynamic file >>> name >>> Veuillez in file serializer? >>> répondre à >>> [hidden email] >>> g >>> >>> >>> >>> >>> >>> >>> >>> Sure. Just add a processor (like XSLT) to your xpl that will >>> prepare >>> the config XML snippet for the oxf:file-serializer processor. >>> >>> A. >>> >>> >>> On Nov 14, 2007, at 11:37 AM, [hidden email] wrote: >>> >>>> I'm trying to save a submitted Orbeon form to a file. The following >>>> xpl works perfectly. >>>> But I would like to be able to name files dynamically. In here I >>>> just have a way to save in test.xml. How can I have something like >>>> test-xxx.xml with xxx the value of a field in my xml output? >>>> >>>> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" >>>> xmlns:oxf="http://www.orbeon.com/oxf/processors"> >>>> >>>> <p:param name="instance" type="input"/> >>>> >>>> <p:processor name="oxf:xml-converter"> >>>> <p:input name="config"> >>>> <config> >>>> <encoding>utf-8</encoding> >>>> </config> >>>> </p:input> >>>> <p:input name="data" href="#instance"/> >>>> <p:output name="data" id="converted"/> >>>> </p:processor> >>>> >>>> <p:processor name="oxf:file-serializer"> >>>> <p:input name="config"> >>>> <config> >>>> <content-type>text/xml</content-type> >>>> <directory>c:/temp</directory> >>>> <file>test.xml</file> >>>> </config> >>>> </p:input> >>>> <p:input name="data" href="#converted"/> >>>> </p:processor> >>>> >>>> </p:config> >>>> >>>> >>>> -- >>>> This message was sent on behalf of [hidden email] at >>>> openSubscriber.com >>>> http://www.opensubscriber.com/messages/ops-users@.../ >>>> topic.html >>>> >>>> -- >>>> 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 >>> >>> >>> >>> -- >>> 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 >> >> >> >> -- >> 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 > > > > -- > 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 -- 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 |