request processor value scope in sql processor

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

request processor value scope in sql processor

smaran

Hi All,

I am talking about processors in crud.xpl.

crud.xpl  is having request generator processor and sql processor.I want to bring a value from request processor to sql processor.to be even clear I will explain with my code.I want bring the value highlighted in red from request processor to sql processor.How can we achive this.Any help appreciated

Request Processor code

<p:processor name="oxf:request">

        <p:input name="config">

            <config stream-type="xs:anyURI">

                <include>/request/request-path</include>

                <include>/request/content-type</include>

                <include>/request/method</include>

                <include>/request/headers/header[name = 'orbeon-username' or name = 'orbeon-roles']</include>

                <include>/request/body</include>

            </config>

        </p:input>

        <p:output name="data" id="request"/>

    </p:processor>

 

Sql processor code

   <p:processor name="oxf:sql">

                        .

  insert

                                                        into <xsl:value-of select="$table-name"/>

                                                        (created, last_modified, username, app, form, <xsl:if test="$is-data">document_id,</xsl:if> deleted,

                                                            <xsl:if test="$is-attachment">file_name, file_content</xsl:if>

                                                            <xsl:if test="not($is-attachment)">xml,</xsl:if>userid)

                                                        values (

                                                            last_created,

                                                            <sql:param type="xs:dateTime" select="/request/timestamp"/>,

                                                            <sql:param type="xs:string" select="/request/username"/>,

                                                            <sql:param type="xs:string" select="/request/app"/>,

                                                            <sql:param type="xs:string" select="/request/form"/>,

                                                            <xsl:if test="$is-data">

                                                                <sql:param type="xs:string" select="/request/document-id"/>,

                                                            </xsl:if>

                                                            'N',

                                                            <xsl:if test="$is-attachment">

                                                                <sql:param type="xs:string" select="/request/filename"/>,

                                                                <sql:param type="xs:anyURI" select="/request/body"/>

                                                            </xsl:if>

                                                            <xsl:if test="not($is-attachment)">

                                                                XMLType(<sql:param type="odt:xmlFragment" sql-type="clob" select="/request/document/*"/>)

                                                                <!-- See comments above -->

                                                                <!--XMLType(<sql:param type="odt:xmlFragment" sql-type="clob" select="saxon:parse(/request/document)"/>)-->

                                                            </xsl:if>,

                                                            <sql:param type="xs:string" select="$ request/headers/header[name = 'orbeon-username' or name = 'orbeon-roles']"/>

                                                        );

                                                end;

 

Please do not print this email unless it is absolutely necessary.

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

crud.xpl (38K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: request processor value scope in sql processor

Erik Bruchez
Administrator
Smaran,

In crud.xpl, you will notice a first oxf:unsafe-xslt that builds a XML document from bits and pieces.

In particular, this takes the request document as input, and produces a request-description document as output.

"request-description" must in this case contain the headers too. You could modify things like this:

Add, just before:

<xsl:copy-of select="$request/body"/>

this line:

<xsl:copy-of select="$request/headers"/>

Then, in oxf:sql:

sql:param type="xs:string" select="$ request/headers/header[name = 'orbeon-username' or name = 'orbeon-roles']"/>

-Erik

On Fri, Mar 11, 2011 at 5:54 AM, <[hidden email]> wrote:

Hi All,

I am talking about processors in crud.xpl.

crud.xpl  is having request generator processor and sql processor.I want to bring a value from request processor to sql processor.to be even clear I will explain with my code.I want bring the value highlighted in red from request processor to sql processor.How can we achive this.Any help appreciated

Request Processor code

<p:processor name="oxf:request">

        <p:input name="config">

            <config stream-type="xs:anyURI">

                <include>/request/request-path</include>

                <include>/request/content-type</include>

                <include>/request/method</include>

                <include>/request/headers/header[name = 'orbeon-username' or name = 'orbeon-roles']</include>

                <include>/request/body</include>

            </config>

        </p:input>

        <p:output name="data" id="request"/>

    </p:processor>

 

Sql processor code

   <p:processor name="oxf:sql">

                        .

  insert

                                                        into <xsl:value-of select="$table-name"/>

                                                        (created, last_modified, username, app, form, <xsl:if test="$is-data">document_id,</xsl:if> deleted,

                                                            <xsl:if test="$is-attachment">file_name, file_content</xsl:if>

                                                            <xsl:if test="not($is-attachment)">xml,</xsl:if>userid)

                                                        values (

                                                            last_created,

                                                            <sql:param type="xs:dateTime" select="/request/timestamp"/>,

                                                            <sql:param type="xs:string" select="/request/username"/>,

                                                            <sql:param type="xs:string" select="/request/app"/>,

                                                            <sql:param type="xs:string" select="/request/form"/>,

                                                            <xsl:if test="$is-data">

                                                                <sql:param type="xs:string" select="/request/document-id"/>,

                                                            </xsl:if>

                                                            'N',

                                                            <xsl:if test="$is-attachment">

                                                                <sql:param type="xs:string" select="/request/filename"/>,

                                                                <sql:param type="xs:anyURI" select="/request/body"/>

                                                            </xsl:if>

                                                            <xsl:if test="not($is-attachment)">

                                                                XMLType(<sql:param type="odt:xmlFragment" sql-type="clob" select="/request/document/*"/>)

                                                                <!-- See comments above -->

                                                                <!--XMLType(<sql:param type="odt:xmlFragment" sql-type="clob" select="saxon:parse(/request/document)"/>)-->

                                                            </xsl:if>,

                                                            <sql:param type="xs:string" select="$ request/headers/header[name = 'orbeon-username' or name = 'orbeon-roles']"/>

                                                        );

                                                end;

 

Please do not print this email unless it is absolutely necessary.

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




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