passing parameters to a specific xslt stylesheet, with data from /request/parameters

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

passing parameters to a specific xslt stylesheet, with data from /request/parameters

Edgard Pineda-2
Hi everyone,
I'm trying to put data from /request/parameters into a call to a
specific xslt stylesheet. I'm a newbie in Orben Forms, and I tried
something like the following without any good results:

  <p:processor name="oxf:request">
    <p:input name="config">
      <config>
        <include>/request/parameters</include>
      </config>
    </p:input>
    <p:output name="data" id="request-info"/>
  </p:processor>

.... (here I generate an xml data: "xml-data") then I tried:

  <p:processor name="oxf:xslt">
    <p:input name="data" href="#xml-data"/>
    <p:input name="config">
      <xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:import href="file:///specific/my.xsl"/>
        <xsl:param name="a_param"
select="#request-info#xpointer(string(/request/parameters/parameter[name='some_param_name']/value))"/>
      </xsl:stylesheet>
    </p:input>
    <p:output name="data" ref="data"/>
  </p:processor>

Finally I got: "Failed to compile stylesheet. 1 error detected."

The my.xsl stylesheet only process the format of #xml-data's content,
but I need to pass a parameter to it which must based on information
retrieved from /request/parameters. How can I accomplish this?

Edgard.



--
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
Reply | Threaded
Open this post in threaded view
|

Re: passing parameters to a specific xslt stylesheet, with data from /request/parameters

Henrik Pettersen
Edgard,

I have attached an example of how to retrieve the username of the
logged in user from the session. Hope this helps.

Henrik

On 11/27/06, Edgard Pineda <[hidden email]> wrote:

> Hi everyone,
> I'm trying to put data from /request/parameters into a call to a
> specific xslt stylesheet. I'm a newbie in Orben Forms, and I tried
> something like the following without any good results:
>
>   <p:processor name="oxf:request">
>     <p:input name="config">
>       <config>
>         <include>/request/parameters</include>
>       </config>
>     </p:input>
>     <p:output name="data" id="request-info"/>
>   </p:processor>
>
> .... (here I generate an xml data: "xml-data") then I tried:
>
>   <p:processor name="oxf:xslt">
>     <p:input name="data" href="#xml-data"/>
>     <p:input name="config">
>       <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>         <xsl:import href="file:///specific/my.xsl"/>
>         <xsl:param name="a_param"
> select="#request-info#xpointer(string(/request/parameters/parameter[name='some_param_name']/value))"/>
>       </xsl:stylesheet>
>     </p:input>
>     <p:output name="data" ref="data"/>
>   </p:processor>
>
> Finally I got: "Failed to compile stylesheet. 1 error detected."
>
> The my.xsl stylesheet only process the format of #xml-data's content,
> but I need to pass a parameter to it which must based on information
> retrieved from /request/parameters. How can I accomplish this?
>
> Edgard.
>
>
>
>
> --
> 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

get.logged.in.user.xpl (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: passing parameters to a specific xslt stylesheet, with data from /request/parameters

Erik Bruchez
Administrator
In reply to this post by Edgard Pineda-2
Edgard,

 > I'm trying to put data from /request/parameters into a call to a
 > specific xslt stylesheet. I'm a newbie in Orben Forms, and I tried
 > something like the following without any good results:
 >
 >  <p:processor name="oxf:request">
 >    <p:input name="config">
 >      <config>
 >        <include>/request/parameters</include>
 >      </config>
 >    </p:input>
 >    <p:output name="data" id="request-info"/>
 >  </p:processor>
 >
 > .... (here I generate an xml data: "xml-data") then I tried:
 >
 >  <p:processor name="oxf:xslt">
 >    <p:input name="data" href="#xml-data"/>
 >    <p:input name="config">
 >      <xsl:stylesheet version="2.0"
 > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 >        <xsl:import href="file:///specific/my.xsl"/>
 >        <xsl:param name="a_param"
 >
select="#request-info#xpointer(string(/request/parameters/parameter[name='some_param_name']/value))"/>

 >
 >      </xsl:stylesheet>
 >    </p:input>
 >    <p:output name="data" ref="data"/>
 >  </p:processor>
 >
 > Finally I got: "Failed to compile stylesheet. 1 error detected."
 >
 > The my.xsl stylesheet only process the format of #xml-data's content,
 > but I need to pass a parameter to it which must based on information
 > retrieved from /request/parameters. How can I accomplish this?

The following code above won't work:

 
select="#request-info#xpointer(string(/request/parameters/parameter[name='some_param_name']/value))

The XSLT @select attribute must be a valid XPath expression. Here, you
are using something that looks like an XPL URI instead.

But what you can do is add your own input on oxf:xslt:

  <p:input name="request" href="#request-info"/>

Then, you can access this from within XSLT:

   select="doc('input:request')/request/parameters/..."

-Erik

--
Orbeon Forms - 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