Thank you Erik for your answer.
Could you tell me more about using XSLT to dynamically build the <xdb:insert> please ?? Is there an exemple in OPS ? Thank you Damien. >Erik wrote: >Damien, > >You can either use XSLT to dynamically build the <xdb:insert> element, >or if you use the REST interface you can use attribute value templates >(AVTs) on xforms:submission/@action. > >Best, > >-Erik > >>Peymirat Damien wrote: >> Hi Erik, >> >> I have done a form to upload document in an eXist database. >> However, I would like to make an xforms:input in my form to enter the >> name of the collection which keeped my document. >> >> I would like to do something like that : >> >> View.xhtml >> >> <xforms:model xxforms:state-handling="client"> >> <xforms:instance> >> <form xmlns=""> >> <selection_projet>/db/sxmldb/test3</selection_projet> >> </form> >> </xforms:instance>... >> >> >> Model.xpl >> >> <p:processor name="oxf:xmldb-insert"> >> <p:input name="datasource" href="datasource.xml"/> >> <p:input name="query"> >> <xdb:insert >> collection="#instance#xpointer(/form/selection_projet)" >> create-collection="true" resource-id="test3.xml"/> >> </p:input> >> <p:input name="data" href="#test"/> >> </p:processor> >> >> >> I test this solution but it does not work. Do you know if a similar >> solution exist ?? >> >> Thank you very much Erik >> Have a nice day >> >> Damien. >> >> -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Hi Damien,
See for instance this code taken from one of the examples. Note that the 'unsafe-xslt' processor is used here, so a Java function can be called. In general you would use the 'xslt' processor. <p:processor name="oxf:unsafe-xslt"> <p:input name="data" href="#blog"/> <p:input name="config"> <xsl:transform version="2.0" xmlns:uuid="java:org.orbeon.oxf.util.UUIDUtils"> <xsl:import href="oxf:/oxf/xslt/utils/copy.xsl"/> <xsl:template match="category/id"> <xsl:copy> <xsl:value-of select="count(../preceding-sibling::category) + 1"/> </xsl:copy> </xsl:template> <xsl:template match="blog/blog-id"> <xsl:copy> <xsl:value-of select="uuid:createPseudoUUID()"/> </xsl:copy> </xsl:template> </xsl:transform> </p:input> <p:output name="data" id="blog-with-ids"/> </p:processor> <p:processor name="oxf:xmldb-insert"> <p:input name="datasource" href="../datasource.xml"/> <p:input name="query"> <xdb:insert collection="/db/ops/blog-example/blogs" create-collection="true"/> </p:input> <p:input name="data" href="#blog-with-ids" schema-href="../schema/blog.rng"/> </p:processor> Alex On 7/27/06, [hidden email] <[hidden email]> wrote: > Thank you Erik for your answer. > > Could you tell me more about using XSLT to dynamically build the <xdb:insert> please ?? Is there an exemple in OPS ? > > > Thank you > > Damien. > > > > > >Erik wrote: > >Damien, > > > >You can either use XSLT to dynamically build the <xdb:insert> element, > >or if you use the REST interface you can use attribute value templates > >(AVTs) on xforms:submission/@action. > > > >Best, > > > >-Erik > > > > > > >>Peymirat Damien wrote: > >> Hi Erik, > >> > >> I have done a form to upload document in an eXist database. > >> However, I would like to make an xforms:input in my form to enter the > >> name of the collection which keeped my document. > >> > >> I would like to do something like that : > >> > >> View.xhtml > >> > >> <xforms:model xxforms:state-handling="client"> > >> <xforms:instance> > >> <form xmlns=""> > >> <selection_projet>/db/sxmldb/test3</selection_projet> > >> </form> > >> </xforms:instance>... > >> > >> > >> Model.xpl > >> > >> <p:processor name="oxf:xmldb-insert"> > >> <p:input name="datasource" href="datasource.xml"/> > >> <p:input name="query"> > >> <xdb:insert > >> collection="#instance#xpointer(/form/selection_projet)" > >> create-collection="true" resource-id="test3.xml"/> > >> </p:input> > >> <p:input name="data" href="#test"/> > >> </p:processor> > >> > >> > >> I test this solution but it does not work. Do you know if a similar > >> solution exist ?? > >> > >> Thank you very much Erik > >> Have a nice day > >> > >> Damien. > >> > >> > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
In reply to this post by damien.peymirat
Hi
I'm testing this solution but I have an error : Failed to compile stylesheet. 1 error detected. Here is my code My instance : <instance> <form> ... <selection_projet>/db/test</selection_projet> </form> </instance> <!-- XSLT generator --> <p:processor name="oxf:xslt"> <p:input name="data" href="#instance#xpointer(/form/selection_projet)"/> <p:input name="config"> <xdb:insert create-collection="true" resource-id="test.xml" xmlns:saxon="http://saxon.sf.net/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="2.0"> <xdb:collection> <xsl:copy-of select="saxon:parse()"/> </xdb:collection> </xdb:insert> </p:input> <p:output name="data" id="xmldbinsert"/> </p:processor> <!-- Insert a document in eXist DataBase--> <p:processor name="oxf:xmldb-insert"> <p:input name="datasource" href="datasource.xml"/> <p:input name="query" href="#xmldbinsert"/> <p:input name="data" href="#test"/> </p:processor> Thank you for your help Bye, Damien. -----Message d'origine----- De : [hidden email] [mailto:[hidden email]] De la part de Alessandro Vernet Envoyé : vendredi 28 juillet 2006 01:33 À : [hidden email] Objet : Re: [ops-users] Re: Question on OPS and eXist database Hi Damien, See for instance this code taken from one of the examples. Note that the 'unsafe-xslt' processor is used here, so a Java function can be called. In general you would use the 'xslt' processor. <p:processor name="oxf:unsafe-xslt"> <p:input name="data" href="#blog"/> <p:input name="config"> <xsl:transform version="2.0" xmlns:uuid="java:org.orbeon.oxf.util.UUIDUtils"> <xsl:import href="oxf:/oxf/xslt/utils/copy.xsl"/> <xsl:template match="category/id"> <xsl:copy> <xsl:value-of select="count(../preceding-sibling::category) + 1"/> </xsl:copy> </xsl:template> <xsl:template match="blog/blog-id"> <xsl:copy> <xsl:value-of select="uuid:createPseudoUUID()"/> </xsl:copy> </xsl:template> </xsl:transform> </p:input> <p:output name="data" id="blog-with-ids"/> </p:processor> <p:processor name="oxf:xmldb-insert"> <p:input name="datasource" href="../datasource.xml"/> <p:input name="query"> <xdb:insert collection="/db/ops/blog-example/blogs" create-collection="true"/> </p:input> <p:input name="data" href="#blog-with-ids" schema-href="../schema/blog.rng"/> </p:processor> Alex On 7/27/06, [hidden email] <[hidden email]> wrote: > Thank you Erik for your answer. > > Could you tell me more about using XSLT to dynamically build the > <xdb:insert> please ?? Is there an exemple in OPS ? > > > Thank you > > Damien. > > > > > >Erik wrote: > >Damien, > > > >You can either use XSLT to dynamically build the <xdb:insert> > >element, or if you use the REST interface you can use attribute value > >templates > >(AVTs) on xforms:submission/@action. > > > >Best, > > > >-Erik > > > > > > >>Peymirat Damien wrote: > >> Hi Erik, > >> > >> I have done a form to upload document in an eXist database. > >> However, I would like to make an xforms:input in my form to enter > >> the name of the collection which keeped my document. > >> > >> I would like to do something like that : > >> > >> View.xhtml > >> > >> <xforms:model xxforms:state-handling="client"> > >> <xforms:instance> > >> <form xmlns=""> > >> <selection_projet>/db/sxmldb/test3</selection_projet> > >> </form> > >> </xforms:instance>... > >> > >> > >> Model.xpl > >> > >> <p:processor name="oxf:xmldb-insert"> > >> <p:input name="datasource" href="datasource.xml"/> > >> <p:input name="query"> > >> <xdb:insert > >> collection="#instance#xpointer(/form/selection_projet)" > >> create-collection="true" resource-id="test3.xml"/> > >> </p:input> > >> <p:input name="data" href="#test"/> > >> </p:processor> > >> > >> > >> I test this solution but it does not work. Do you know if a similar > >> solution exist ?? > >> > >> Thank you very much Erik > >> Have a nice day > >> > >> Damien. > >> > >> > > > > > -- > You receive this message as a subscriber of the > [hidden email] mailing list. To unsubscribe: > mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Hi Damien,
If you look at the PresentationServer logs, you should find a more detailed message corresponding to the XSLT error. Looking at the XSLT source in your message, the call to saxon:parse() seems suspicious as that function takes an argument but is here provided none. Alex On 7/28/06, Peymirat Damien <[hidden email]> wrote: > Hi > > > I'm testing this solution but I have an error : Failed to compile stylesheet. 1 error detected. > > Here is my code > > My instance : > <instance> > <form> > ... > <selection_projet>/db/test</selection_projet> > </form> > </instance> > > > <!-- XSLT generator --> > <p:processor name="oxf:xslt"> > <p:input name="data" href="#instance#xpointer(/form/selection_projet)"/> > <p:input name="config"> > <xdb:insert create-collection="true" resource-id="test.xml" xmlns:saxon="http://saxon.sf.net/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="2.0"> > <xdb:collection> > <xsl:copy-of select="saxon:parse()"/> > </xdb:collection> > </xdb:insert> > </p:input> > <p:output name="data" id="xmldbinsert"/> > </p:processor> > <!-- Insert a document in eXist DataBase--> > <p:processor name="oxf:xmldb-insert"> > <p:input name="datasource" href="datasource.xml"/> > <p:input name="query" href="#xmldbinsert"/> > <p:input name="data" href="#test"/> > </p:processor> > > > > Thank you for your help > > Bye, Damien. > > > > -----Message d'origine----- > De : [hidden email] [mailto:[hidden email]] De la part de Alessandro Vernet > Envoyé : vendredi 28 juillet 2006 01:33 > À : [hidden email] > Objet : Re: [ops-users] Re: Question on OPS and eXist database > > > Hi Damien, > > See for instance this code taken from one of the examples. Note that the 'unsafe-xslt' processor is used here, so a Java function can be called. In general you would use the 'xslt' processor. > > <p:processor name="oxf:unsafe-xslt"> > <p:input name="data" href="#blog"/> > <p:input name="config"> > <xsl:transform version="2.0" xmlns:uuid="java:org.orbeon.oxf.util.UUIDUtils"> > <xsl:import href="oxf:/oxf/xslt/utils/copy.xsl"/> > <xsl:template match="category/id"> > <xsl:copy> > <xsl:value-of > select="count(../preceding-sibling::category) + 1"/> > </xsl:copy> > </xsl:template> > <xsl:template match="blog/blog-id"> > <xsl:copy> > <xsl:value-of select="uuid:createPseudoUUID()"/> > </xsl:copy> > </xsl:template> > </xsl:transform> > </p:input> > <p:output name="data" id="blog-with-ids"/> > </p:processor> > > <p:processor name="oxf:xmldb-insert"> > <p:input name="datasource" href="../datasource.xml"/> > <p:input name="query"> > <xdb:insert collection="/db/ops/blog-example/blogs" > create-collection="true"/> > </p:input> > <p:input name="data" href="#blog-with-ids" schema-href="../schema/blog.rng"/> > </p:processor> > > Alex > > On 7/27/06, [hidden email] <[hidden email]> wrote: > > Thank you Erik for your answer. > > > > Could you tell me more about using XSLT to dynamically build the > > <xdb:insert> please ?? Is there an exemple in OPS ? > > > > > > Thank you > > > > Damien. > > > > > > > > > > >Erik wrote: > > >Damien, > > > > > >You can either use XSLT to dynamically build the <xdb:insert> > > >element, or if you use the REST interface you can use attribute value > > >templates > > >(AVTs) on xforms:submission/@action. > > > > > >Best, > > > > > >-Erik > > > > > > > > > > > >>Peymirat Damien wrote: > > >> Hi Erik, > > >> > > >> I have done a form to upload document in an eXist database. > > >> However, I would like to make an xforms:input in my form to enter > > >> the name of the collection which keeped my document. > > >> > > >> I would like to do something like that : > > >> > > >> View.xhtml > > >> > > >> <xforms:model xxforms:state-handling="client"> > > >> <xforms:instance> > > >> <form xmlns=""> > > >> <selection_projet>/db/sxmldb/test3</selection_projet> > > >> </form> > > >> </xforms:instance>... > > >> > > >> > > >> Model.xpl > > >> > > >> <p:processor name="oxf:xmldb-insert"> > > >> <p:input name="datasource" href="datasource.xml"/> > > >> <p:input name="query"> > > >> <xdb:insert > > >> collection="#instance#xpointer(/form/selection_projet)" > > >> create-collection="true" resource-id="test3.xml"/> > > >> </p:input> > > >> <p:input name="data" href="#test"/> > > >> </p:processor> > > >> > > >> > > >> I test this solution but it does not work. Do you know if a similar > > >> solution exist ?? > > >> > > >> Thank you very much Erik > > >> Have a nice day > > >> > > >> Damien. > > >> > > >> > > > > > > > > > > -- > > You receive this message as a subscriber of the > > [hidden email] mailing list. To unsubscribe: > > mailto:[hidden email] > > For general help: mailto:[hidden email]?subject=help > > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > > > > > > > -- > Blog (XML, Web apps, Open Source): > http://www.orbeon.com/blog/ > > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
In reply to this post by Peymirat Damien
Thank you Alex,
The error was on the saxon:parse() fonction. I replace it with just "/". However, I have a new error now : Error element "xdb:insert" is missing "collection" attribute(schema: http://www.orbeon.org/oxf/xmldb-query) But if I put "collection" as a "xdb:insert" attribute, How can I select my collection ??? "xdb:collection" is not allowed ??? Best regards Damien. -----Message d'origine----- De : [hidden email] [mailto:[hidden email]] De la part de Alessandro Vernet Envoyé : samedi 29 juillet 2006 03:02 À : [hidden email] Objet : Re: RE : [ops-users] Re: Question on OPS and eXist database Hi Damien, If you look at the PresentationServer logs, you should find a more detailed message corresponding to the XSLT error. Looking at the XSLT source in your message, the call to saxon:parse() seems suspicious as that function takes an argument but is here provided none. Alex On 7/28/06, Peymirat Damien <[hidden email]> wrote: > Hi > > > I'm testing this solution but I have an error : Failed to compile > stylesheet. 1 error detected. > > Here is my code > > My instance : > <instance> > <form> > ... > <selection_projet>/db/test</selection_projet> > </form> > </instance> > > > <!-- XSLT generator --> > <p:processor name="oxf:xslt"> > <p:input name="data" href="#instance#xpointer(/form/selection_projet)"/> > <p:input name="config"> > <xdb:insert create-collection="true" resource-id="test.xml" xmlns:saxon="http://saxon.sf.net/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="2.0"> > <xdb:collection> > <xsl:copy-of select="saxon:parse()"/> > </xdb:collection> > </xdb:insert> > </p:input> > <p:output name="data" id="xmldbinsert"/> </p:processor> > <!-- Insert a document in eXist DataBase--> > <p:processor name="oxf:xmldb-insert"> > <p:input name="datasource" href="datasource.xml"/> > <p:input name="query" href="#xmldbinsert"/> > <p:input name="data" href="#test"/> > </p:processor> > > > > Thank you for your help > > Bye, Damien. > > > > -----Message d'origine----- > De : [hidden email] [mailto:[hidden email]] De la part de Alessandro Vernet > Envoyé : vendredi 28 juillet 2006 01:33 > À : [hidden email] > Objet : Re: [ops-users] Re: Question on OPS and eXist database > > > Hi Damien, > > See for instance this code taken from one of the examples. Note that the 'unsafe-xslt' processor is used here, so a Java function can be called. In general you would use the 'xslt' processor. > > <p:processor name="oxf:unsafe-xslt"> > <p:input name="data" href="#blog"/> > <p:input name="config"> > <xsl:transform version="2.0" xmlns:uuid="java:org.orbeon.oxf.util.UUIDUtils"> > <xsl:import href="oxf:/oxf/xslt/utils/copy.xsl"/> > <xsl:template match="category/id"> > <xsl:copy> > <xsl:value-of > select="count(../preceding-sibling::category) + 1"/> > </xsl:copy> > </xsl:template> > <xsl:template match="blog/blog-id"> > <xsl:copy> > <xsl:value-of select="uuid:createPseudoUUID()"/> > </xsl:copy> > </xsl:template> > </xsl:transform> > </p:input> > <p:output name="data" id="blog-with-ids"/> > </p:processor> > > <p:processor name="oxf:xmldb-insert"> > <p:input name="datasource" href="../datasource.xml"/> > <p:input name="query"> > <xdb:insert collection="/db/ops/blog-example/blogs" > create-collection="true"/> > </p:input> > <p:input name="data" href="#blog-with-ids" schema-href="../schema/blog.rng"/> > </p:processor> > > Alex > > On 7/27/06, [hidden email] <[hidden email]> wrote: > > Thank you Erik for your answer. > > > > Could you tell me more about using XSLT to dynamically build the > > <xdb:insert> please ?? Is there an exemple in OPS ? > > > > > > Thank you > > > > Damien. > > > > > > > > > > >Erik wrote: > > >Damien, > > > > > >You can either use XSLT to dynamically build the <xdb:insert> > > >element, or if you use the REST interface you can use attribute value > > >templates > > >(AVTs) on xforms:submission/@action. > > > > > >Best, > > > > > >-Erik > > > > > > > > > > > >>Peymirat Damien wrote: > > >> Hi Erik, > > >> > > >> I have done a form to upload document in an eXist database. > > >> However, I would like to make an xforms:input in my form to enter > > >> the name of the collection which keeped my document. > > >> > > >> I would like to do something like that : > > >> > > >> View.xhtml > > >> > > >> <xforms:model xxforms:state-handling="client"> > > >> <xforms:instance> > > >> <form xmlns=""> > > >> <selection_projet>/db/sxmldb/test3</selection_projet> > > >> </form> > > >> </xforms:instance>... > > >> > > >> > > >> Model.xpl > > >> > > >> <p:processor name="oxf:xmldb-insert"> > > >> <p:input name="datasource" href="datasource.xml"/> > > >> <p:input name="query"> > > >> <xdb:insert > > >> collection="#instance#xpointer(/form/selection_projet)" > > >> create-collection="true" resource-id="test3.xml"/> > > >> </p:input> > > >> <p:input name="data" href="#test"/> > > >> </p:processor> > > >> > > >> > > >> I test this solution but it does not work. Do you know if a similar > > >> solution exist ?? > > >> > > >> Thank you very much Erik > > >> Have a nice day > > >> > > >> Damien. > > >> > > >> > > > > > > > > > > -- > > You receive this message as a subscriber of the > > [hidden email] mailing list. To unsubscribe: > > mailto:[hidden email] > > For general help: mailto:[hidden email]?subject=help > > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > > > > > > > -- > Blog (XML, Web apps, Open Source): > http://www.orbeon.com/blog/ > > > > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Damien,
If you want to dynamically generate the collection name, use XSLT first to produce the whole <xdb:insert> element, then send that to the oxf:xmldb-insert processor. -Erik Peymirat Damien wrote: > Thank you Alex, > > The error was on the saxon:parse() fonction. I replace it with just "/". However, I have a new error now : Error element "xdb:insert" is missing "collection" attribute(schema: http://www.orbeon.org/oxf/xmldb-query) > > But if I put "collection" as a "xdb:insert" attribute, How can I select my collection ??? > "xdb:collection" is not allowed ??? > > Best regards > > Damien. > > > > -----Message d'origine----- > De : [hidden email] [mailto:[hidden email]] De la part de Alessandro Vernet > Envoyé : samedi 29 juillet 2006 03:02 > À : [hidden email] > Objet : Re: RE : [ops-users] Re: Question on OPS and eXist database > > > Hi Damien, > > If you look at the PresentationServer logs, you should find a more detailed message corresponding to the XSLT error. Looking at the XSLT source in your message, the call to saxon:parse() seems suspicious as that function takes an argument but is here provided none. > > Alex > > On 7/28/06, Peymirat Damien <[hidden email]> wrote: >> Hi >> >> >> I'm testing this solution but I have an error : Failed to compile >> stylesheet. 1 error detected. >> >> Here is my code >> >> My instance : >> <instance> >> <form> >> ... >> <selection_projet>/db/test</selection_projet> >> </form> >> </instance> >> >> >> <!-- XSLT generator --> >> <p:processor name="oxf:xslt"> >> <p:input name="data" href="#instance#xpointer(/form/selection_projet)"/> >> <p:input name="config"> >> <xdb:insert create-collection="true" resource-id="test.xml" xmlns:saxon="http://saxon.sf.net/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="2.0"> >> <xdb:collection> >> <xsl:copy-of select="saxon:parse()"/> >> </xdb:collection> >> </xdb:insert> >> </p:input> >> <p:output name="data" id="xmldbinsert"/> </p:processor> >> <!-- Insert a document in eXist DataBase--> >> <p:processor name="oxf:xmldb-insert"> >> <p:input name="datasource" href="datasource.xml"/> >> <p:input name="query" href="#xmldbinsert"/> >> <p:input name="data" href="#test"/> >> </p:processor> >> >> >> >> Thank you for your help >> >> Bye, Damien. >> >> >> >> -----Message d'origine----- >> De : [hidden email] [mailto:[hidden email]] De la part de Alessandro Vernet >> Envoyé : vendredi 28 juillet 2006 01:33 >> À : [hidden email] >> Objet : Re: [ops-users] Re: Question on OPS and eXist database >> >> >> Hi Damien, >> >> See for instance this code taken from one of the examples. Note that the 'unsafe-xslt' processor is used here, so a Java function can be called. In general you would use the 'xslt' processor. >> >> <p:processor name="oxf:unsafe-xslt"> >> <p:input name="data" href="#blog"/> >> <p:input name="config"> >> <xsl:transform version="2.0" xmlns:uuid="java:org.orbeon.oxf.util.UUIDUtils"> >> <xsl:import href="oxf:/oxf/xslt/utils/copy.xsl"/> >> <xsl:template match="category/id"> >> <xsl:copy> >> <xsl:value-of >> select="count(../preceding-sibling::category) + 1"/> >> </xsl:copy> >> </xsl:template> >> <xsl:template match="blog/blog-id"> >> <xsl:copy> >> <xsl:value-of select="uuid:createPseudoUUID()"/> >> </xsl:copy> >> </xsl:template> >> </xsl:transform> >> </p:input> >> <p:output name="data" id="blog-with-ids"/> >> </p:processor> >> >> <p:processor name="oxf:xmldb-insert"> >> <p:input name="datasource" href="../datasource.xml"/> >> <p:input name="query"> >> <xdb:insert collection="/db/ops/blog-example/blogs" >> create-collection="true"/> >> </p:input> >> <p:input name="data" href="#blog-with-ids" schema-href="../schema/blog.rng"/> >> </p:processor> >> >> Alex >> >> On 7/27/06, [hidden email] <[hidden email]> wrote: >>> Thank you Erik for your answer. >>> >>> Could you tell me more about using XSLT to dynamically build the >>> <xdb:insert> please ?? Is there an exemple in OPS ? >>> >>> >>> Thank you >>> >>> Damien. >>> >>> >>> >>> >>>> Erik wrote: >>>> Damien, >>>> >>>> You can either use XSLT to dynamically build the <xdb:insert> >>>> element, or if you use the REST interface you can use attribute value >>>> templates >>>> (AVTs) on xforms:submission/@action. >>>> >>>> Best, >>>> >>>> -Erik >>>> >>> >>> >>>>> Peymirat Damien wrote: >>>>> Hi Erik, >>>>> >>>>> I have done a form to upload document in an eXist database. >>>>> However, I would like to make an xforms:input in my form to enter >>>>> the name of the collection which keeped my document. >>>>> >>>>> I would like to do something like that : >>>>> >>>>> View.xhtml >>>>> >>>>> <xforms:model xxforms:state-handling="client"> >>>>> <xforms:instance> >>>>> <form xmlns=""> >>>>> <selection_projet>/db/sxmldb/test3</selection_projet> >>>>> </form> >>>>> </xforms:instance>... >>>>> >>>>> >>>>> Model.xpl >>>>> >>>>> <p:processor name="oxf:xmldb-insert"> >>>>> <p:input name="datasource" href="datasource.xml"/> >>>>> <p:input name="query"> >>>>> <xdb:insert >>>>> collection="#instance#xpointer(/form/selection_projet)" >>>>> create-collection="true" resource-id="test3.xml"/> >>>>> </p:input> >>>>> <p:input name="data" href="#test"/> >>>>> </p:processor> >>>>> >>>>> >>>>> I test this solution but it does not work. Do you know if a similar >>>>> solution exist ?? >>>>> >>>>> Thank you very much Erik >>>>> Have a nice day >>>>> >>>>> Damien. >>>>> >>>>> >>> >>> >>> >>> -- >>> You receive this message as a subscriber of the >>> [hidden email] mailing list. To unsubscribe: >>> mailto:[hidden email] >>> For general help: mailto:[hidden email]?subject=help >>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws >>> >>> >>> >> >> -- >> Blog (XML, Web apps, Open Source): >> http://www.orbeon.com/blog/ >> >> >> >> >> >> -- >> You receive this message as a subscriber of the [hidden email] mailing list. >> To unsubscribe: mailto:[hidden email] >> For general help: mailto:[hidden email]?subject=help >> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws >> >> >> > > > > ------------------------------------------------------------------------ > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by Peymirat Damien
Thank you Alex & Erik
Now it works well !! Here is part of my code for OPS users : View.xhtml <xforms:instance> <form xmlns=""> <file filename="" mediatype="" size=""/> <selection_projet/> </form> </xforms:instance> Upload.xpl <!-- XSLT generator --> <p:processor name="oxf:xslt"> <p:input name="data" href="#instance"/> <p:input name="config"> <xdb:insert collection="{/form/selection_projet}" resource-id="{/form/file/@filename}" xmlns:saxon="http://saxon.sf.net/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="2.0"/> </p:input> <p:output name="data" id="xmldbinsert"/> </p:processor> <!-- Insert a document in eXist DataBase--> <p:processor name="oxf:xmldb-insert"> <p:input name="datasource" href="datasource.xml"/> <p:input name="query" href="#xmldbinsert"/> <p:input name="data" href="#test"/> </p:processor> -----Message d'origine----- De : Erik Bruchez [mailto:[hidden email]] De la part de Erik Bruchez Envoyé : jeudi 3 août 2006 20:38 À : [hidden email] Objet : Re: RE : RE : [ops-users] Re: Question on OPS and eXist database Damien, If you want to dynamically generate the collection name, use XSLT first to produce the whole <xdb:insert> element, then send that to the oxf:xmldb-insert processor. -Erik Peymirat Damien wrote: > Thank you Alex, > > The error was on the saxon:parse() fonction. I replace it with just > "/". However, I have a new error now : Error element "xdb:insert" is > missing "collection" attribute(schema: > http://www.orbeon.org/oxf/xmldb-query) > > But if I put "collection" as a "xdb:insert" attribute, How can I > select my collection ??? "xdb:collection" is not allowed ??? > > Best regards > > Damien. > > > > -----Message d'origine----- > De : [hidden email] [mailto:[hidden email]] De la part de > Alessandro Vernet Envoyé : samedi 29 juillet 2006 03:02 À : > [hidden email] Objet : Re: RE : [ops-users] Re: Question on > OPS and eXist database > > > Hi Damien, > > If you look at the PresentationServer logs, you should find a more > detailed message corresponding to the XSLT error. Looking at the XSLT > source in your message, the call to saxon:parse() seems suspicious as > that function takes an argument but is here provided none. > > Alex > > On 7/28/06, Peymirat Damien <[hidden email]> wrote: >> Hi >> >> >> I'm testing this solution but I have an error : Failed to compile >> stylesheet. 1 error detected. >> >> Here is my code >> >> My instance : >> <instance> >> <form> >> ... >> <selection_projet>/db/test</selection_projet> >> </form> >> </instance> >> >> >> <!-- XSLT generator --> >> <p:processor name="oxf:xslt"> >> <p:input name="data" href="#instance#xpointer(/form/selection_projet)"/> >> <p:input name="config"> >> <xdb:insert create-collection="true" resource-id="test.xml" xmlns:saxon="http://saxon.sf.net/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="2.0"> >> <xdb:collection> >> <xsl:copy-of select="saxon:parse()"/> >> </xdb:collection> >> </xdb:insert> >> </p:input> >> <p:output name="data" id="xmldbinsert"/> </p:processor> >> <!-- Insert a document in eXist DataBase--> >> <p:processor name="oxf:xmldb-insert"> >> <p:input name="datasource" href="datasource.xml"/> >> <p:input name="query" href="#xmldbinsert"/> >> <p:input name="data" href="#test"/> >> </p:processor> >> >> >> >> Thank you for your help >> >> Bye, Damien. >> >> >> >> -----Message d'origine----- >> De : [hidden email] [mailto:[hidden email]] De la part de >> Alessandro Vernet Envoyé : vendredi 28 juillet 2006 01:33 À : >> [hidden email] Objet : Re: [ops-users] Re: Question on OPS >> and eXist database >> >> >> Hi Damien, >> >> See for instance this code taken from one of the examples. Note that >> the 'unsafe-xslt' processor is used here, so a Java function can be >> called. In general you would use the 'xslt' processor. >> >> <p:processor name="oxf:unsafe-xslt"> >> <p:input name="data" href="#blog"/> >> <p:input name="config"> >> <xsl:transform version="2.0" xmlns:uuid="java:org.orbeon.oxf.util.UUIDUtils"> >> <xsl:import href="oxf:/oxf/xslt/utils/copy.xsl"/> >> <xsl:template match="category/id"> >> <xsl:copy> >> <xsl:value-of >> select="count(../preceding-sibling::category) + 1"/> >> </xsl:copy> >> </xsl:template> >> <xsl:template match="blog/blog-id"> >> <xsl:copy> >> <xsl:value-of select="uuid:createPseudoUUID()"/> >> </xsl:copy> >> </xsl:template> >> </xsl:transform> >> </p:input> >> <p:output name="data" id="blog-with-ids"/> </p:processor> >> >> <p:processor name="oxf:xmldb-insert"> >> <p:input name="datasource" href="../datasource.xml"/> >> <p:input name="query"> >> <xdb:insert collection="/db/ops/blog-example/blogs" >> create-collection="true"/> >> </p:input> >> <p:input name="data" href="#blog-with-ids" >> schema-href="../schema/blog.rng"/> >> </p:processor> >> >> Alex >> >> On 7/27/06, [hidden email] >> <[hidden email]> wrote: >>> Thank you Erik for your answer. >>> >>> Could you tell me more about using XSLT to dynamically build the >>> <xdb:insert> please ?? Is there an exemple in OPS ? >>> >>> >>> Thank you >>> >>> Damien. >>> >>> >>> >>> >>>> Erik wrote: >>>> Damien, >>>> >>>> You can either use XSLT to dynamically build the <xdb:insert> >>>> element, or if you use the REST interface you can use attribute >>>> value templates >>>> (AVTs) on xforms:submission/@action. >>>> >>>> Best, >>>> >>>> -Erik >>>> >>> >>> >>>>> Peymirat Damien wrote: >>>>> Hi Erik, >>>>> >>>>> I have done a form to upload document in an eXist database. >>>>> However, I would like to make an xforms:input in my form to enter >>>>> the name of the collection which keeped my document. >>>>> >>>>> I would like to do something like that : >>>>> >>>>> View.xhtml >>>>> >>>>> <xforms:model xxforms:state-handling="client"> >>>>> <xforms:instance> >>>>> <form xmlns=""> >>>>> <selection_projet>/db/sxmldb/test3</selection_projet> >>>>> </form> >>>>> </xforms:instance>... >>>>> >>>>> >>>>> Model.xpl >>>>> >>>>> <p:processor name="oxf:xmldb-insert"> >>>>> <p:input name="datasource" href="datasource.xml"/> >>>>> <p:input name="query"> >>>>> <xdb:insert >>>>> collection="#instance#xpointer(/form/selection_projet)" >>>>> create-collection="true" resource-id="test3.xml"/> >>>>> </p:input> >>>>> <p:input name="data" href="#test"/> >>>>> </p:processor> >>>>> >>>>> >>>>> I test this solution but it does not work. Do you know if a >>>>> similar solution exist ?? >>>>> >>>>> Thank you very much Erik >>>>> Have a nice day >>>>> >>>>> Damien. >>>>> >>>>> >>> >>> >>> >>> -- >>> You receive this message as a subscriber of the >>> [hidden email] mailing list. To unsubscribe: >>> mailto:[hidden email] >>> For general help: mailto:[hidden email]?subject=help >>> ObjectWeb mailing lists service home page: >>> http://www.objectweb.org/wws >>> >>> >>> >> >> -- >> Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ >> >> >> >> >> >> -- >> You receive this message as a subscriber of the [hidden email] mailing list. >> To unsubscribe: mailto:[hidden email] >> For general help: mailto:[hidden email]?subject=help >> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws >> >> >> > > > > ------------------------------------------------------------------------ > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |