Hi all,
I have another problem that is probably simple, but I can't find it documented anywhere. There is a lot of documentation on passing URL parameters to instances in forms, but I can't find anything about passing a URL parameter to a view generated by an XSLT stylesheet from a source XML file. For example, my PFC contains: <page path-info="/ead/admin/" id="admin" model="http://localhost:8080/orbeon/exist/rest/db/ead" view="xslt/file_list.xsl"/> I'm using file_list.xsl to render the contents of my exist collection. However, I want to pass a "page" URL param to the stylesheet so I can work on pagination. Cocoon pipelines have an option called <map:parameter name="use-request-parameters" value="true"/> to accomplish this. Is there an equivalent in Orbeon? Parameters don't seem to be passed to the stylesheet by default. Thanks, Ethan -- 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 Ethan,
> I'm using file_list.xsl to render the contents of my exist collection. > However, I want to pass a "page" URL param to the stylesheet so I can > work on pagination. Cocoon pipelines have an option called > <map:parameter name="use-request-parameters" value="true"/> to > accomplish this. Is there an equivalent in Orbeon? Parameters don't > seem to be passed to the stylesheet by default. AFAIK it's possible to pass the url parameters to the XSLT view (using the setvalue elements and a default submission [1]). But using that way, you can't submit the eXist collection listing, i fear. So the problem is that there's no way to submit multiple xml instances to a model or view. A possible solution may be to create an xpl pipeline as model that takes the URL parameters as default submission (see [1]) and reads the eXist Collection content. Then, the XPL can aggregate that data into one xml fragement and pass it to the view, or it could apply the pagination restriction to the collection listing itself and pass just the result to the view. Another variation: let the XPL call the XSLT transformation, then you don't need to specify the XSLT in the PFC entry. Another way to solve the task would be to put the pagination information into the scope using the scope serializer and read it from there using the scope generator - this is my preferred way because it hides the pagination information from the user so there's no way to "mess around" with those strange url parameters :). HTH florian [1] http://www.orbeon.com/orbeon/doc/reference-page-flow#url-extraction -- 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 Florian,
Thanks for helping me get started. After looking through the archives, I found out how to pass the URL parameter to the XSLT as a input:request document. Ethan On Wed, Mar 24, 2010 at 9:02 AM, Florian Schmitt <[hidden email]> wrote: Hi Ethan, -- 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 |
As a followup to my previous question, I'd like to do something a bit more dynamic and complicated. The scenario is I wish to have a path /ead/results/?q=(.*)&start=(.*) that gets gets XML search results from Solr, passing the q and start parameters and runs it through an xpl view to transform that into HTML like so:
<page path-info="/ead/results/?q=(.*)&start(.*)" matcher="oxf:perl5-matcher" model="<a href="http://localhost:8080/solr/published/select?q=${1}&amp;start=${2}">http://localhost:8080/solr/published/select?q=${1}&start=${2}" view="xpl/results.xpl"/> This syntax unfortunately doesn't work, but I tried changing path-info to /ead/results/(.*)/(.*) which will display the page, but I still need to be able to pass the q and start parameters to the XSLT stylesheet described in results.xpl and /ead/results/fulltext:jefferson/0?q=fulltext:jefferson&start=0 is pretty redundant. I inserted into the <page>: <setvalue ref="/parameters/q" matcher-group="1"/> <setvalue ref="/parameters/start" matcher-group="2"/> but I'm not quite sure how to access these values from the stylesheet, if I did that correctly to begin with. Here is my results.xpl, if it is useful <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:oxf="http://www.orbeon.com/oxf/processors"> <p:param type="input" name="data"/> <p:param type="output" name="data"/> <p:processor name="oxf:request"> <p:input name="config"> <config> <include>/request/parameters</include> </config> </p:input> <p:output name="data" id="request"/> </p:processor> <p:processor name="oxf:xslt"> <p:input name="data" href="#data"/> <p:input name="request" href="#request"/> <p:input name="config" href="../xslt/results.xsl"/> <p:output name="data" ref="data"/> </p:processor> </p:config> Ideally I would like to keep the parameters in the URL itself but I can reorganize my code to use /ead/results/{query}/{start} if I can pass both variables into the stylesheet some other way. Thanks for the help, Ethan On Fri, Mar 26, 2010 at 11:15 AM, Ethan Gruber <[hidden email]> wrote: Hi 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 |
Administrator
|
Ethan,
The setvalue will populate an XML document for which you provide a template with the default-submission attribute. Then that document is passed down as "instance" to the view and model, as long as there wasn't already an XML posted to that page. See: http://www.orbeon.com/orbeon/doc/reference-page-flow#url-extraction Alex On Fri, Mar 26, 2010 at 1:00 PM, Ethan Gruber <[hidden email]> wrote: > As a followup to my previous question, I'd like to do something a bit more > dynamic and complicated. The scenario is I wish to have a path > /ead/results/?q=(.*)&start=(.*) that gets gets XML search results from Solr, > passing the q and start parameters and runs it through an xpl view to > transform that into HTML like so: > > <page path-info="/ead/results/?q=(.*)&start(.*)" matcher="oxf:perl5-matcher" > > model="http://localhost:8080/solr/published/select?q=${1}&start=${2}" > view="xpl/results.xpl"/> > > This syntax unfortunately doesn't work, but I tried changing path-info to > /ead/results/(.*)/(.*) which will display the page, but I still need to be > able to pass the q and start parameters to the XSLT stylesheet described in > results.xpl and > /ead/results/fulltext:jefferson/0?q=fulltext:jefferson&start=0 is pretty > redundant. > > I inserted into the <page>: > > <setvalue ref="/parameters/q" matcher-group="1"/> > <setvalue ref="/parameters/start" matcher-group="2"/> > > but I'm not quite sure how to access these values from the stylesheet, if I > did that correctly to begin with. > > Here is my results.xpl, if it is useful > > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" > xmlns:oxf="http://www.orbeon.com/oxf/processors"> > > <p:param type="input" name="data"/> > <p:param type="output" name="data"/> > > <p:processor name="oxf:request"> > <p:input name="config"> > <config> > <include>/request/parameters</include> > </config> > </p:input> > <p:output name="data" id="request"/> > </p:processor> > > <p:processor name="oxf:xslt"> > <p:input name="data" href="#data"/> > <p:input name="request" href="#request"/> > <p:input name="config" href="../xslt/results.xsl"/> > <p:output name="data" ref="data"/> > </p:processor> > > </p:config> > > Ideally I would like to keep the parameters in the URL itself but I can > reorganize my code to use /ead/results/{query}/{start} if I can pass both > variables into the stylesheet some other way. > > Thanks for the help, > Ethan > > On Fri, Mar 26, 2010 at 11:15 AM, Ethan Gruber <[hidden email]> wrote: >> >> Hi Florian, >> >> Thanks for helping me get started. After looking through the archives, I >> found out how to pass the URL parameter to the XSLT as a input:request >> document. >> >> Ethan >> >> On Wed, Mar 24, 2010 at 9:02 AM, Florian Schmitt >> <[hidden email]> wrote: >>> >>> Hi Ethan, >>> >>> > I'm using file_list.xsl to render the contents of my exist collection. >>> > However, I want to pass a "page" URL param to the stylesheet so I can >>> > work on pagination. Cocoon pipelines have an option called >>> > <map:parameter name="use-request-parameters" value="true"/> to >>> > accomplish this. Is there an equivalent in Orbeon? Parameters don't >>> > seem to be passed to the stylesheet by default. >>> >>> AFAIK it's possible to pass the url parameters to the XSLT view (using >>> the setvalue elements and a default submission [1]). But using that way, >>> you can't submit the eXist collection listing, i fear. So the problem >>> is that there's no way to submit multiple xml instances to a model or >>> view. >>> >>> A possible solution may be to create an xpl pipeline as model that takes >>> the URL parameters as default submission (see [1]) and reads the eXist >>> Collection content. Then, the XPL can aggregate that data into one xml >>> fragement and pass it to the view, or it could apply the pagination >>> restriction to the collection listing itself and pass just the result to >>> the view. Another variation: let the XPL call the XSLT transformation, >>> then you don't need to specify the XSLT in the PFC entry. >>> >>> Another way to solve the task would be to put the pagination information >>> into the scope using the scope serializer and read it from there using >>> the scope generator - this is my preferred way because it hides the >>> pagination information from the user so there's no way to "mess around" >>> with those strange url parameters :). >>> >>> >>> HTH >>> florian >>> >>> [1] http://www.orbeon.com/orbeon/doc/reference-page-flow#url-extraction >>> >>> >>> >>> -- >>> 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, open-source, for the Enterprise - http://www.orbeon.com/ My Twitter: http://twitter.com/avernet -- 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |