Simple XPL problem

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

Simple XPL problem

Edpriwer
Hi, I'm quite new to the world of Orbeon; hopefully you can help with a very simple problem...

I've got an XPL file that accepts an XML doc, retrieves some data via sql using values from the XML doc as selection parameters, and then builds and outputs another XML doc.

My problem is quite simple: in the xml doc that I am building & outputting I hope to include some values from the XML input file. I can't figure out how to do this - I'm sure the answer is quite simple but I can't find it...

I tried something like <xi:include href="#instance" xpointer="review/employee-name"/> but this included the whole input doc, and I'm hoping to include just the employee-name value from the input xml. I'm sure there's a very simple answer, but I haven't been able to find it yet...

Thanks



--
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: Simple XPL problem

Alessandro Vernet
Administrator
One strategy is to connect the output of your SQL processor to the
"data" input of an XSLT processor. Connect also the "instance" input
of the pipeline to an input of the SQL called "instance". Then in the
SQL, you can access that "instance" document with
doc('input:instance'). With this, you should be able insert the value
from "instance" where required in the document.

I hope this helps,

Alex

On 4/9/07, [hidden email] <[hidden email]> wrote:

> Hi, I'm quite new to the world of Orbeon; hopefully you can help with a very simple problem...
>
> I've got an XPL file that accepts an XML doc, retrieves some data via sql using values from the XML doc as selection parameters, and then builds and outputs another XML doc.
>
> My problem is quite simple: in the xml doc that I am building & outputting I hope to include some values from the XML input file. I can't figure out how to do this - I'm sure the answer is quite simple but I can't find it...
>
> I tried something like <xi:include href="#instance" xpointer="review/employee-name"/> but this included the whole input doc, and I'm hoping to include just the employee-name value from the input xml. I'm sure there's a very simple answer, but I haven't been able to find it yet...
>
> Thanks
>
>
>
> --
> 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 Forms - Web 2.0 Forms for the Enterprise
http://www.orbeon.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Simple XPL problem

Edpriwer
Thanks for your reply Alex, however I was hoping there would be a simpler solution. I've since came up with this solution in my XPL SQL processor...

<sql:execute>
  <sql:query>
    select data_i_want_to_get,
      <sql:param type="xs:string" select="/current-item/data-i-already-know"/> as data_i_already_know
    from table
    where id=<sql:param type="xs:int" select="/current-item/id"/>
  </sql:query>
  <sql:result-set>
    <sql:row-iterator>
      <result>
        <elem1><sql:get-column-value column="data_i_want_to_get"/></elem1>
        <elem2><sql:get-column-value column="data_i_already_know"/></elem2>
      </result>
    </sql:row-iterator>
  </sql:result-set>
</sql:execute>

This isn't ideal (as I'm adding unecessary stuff to my sql), but works. As I mentioned before, a tag like <xi:include href="#instance" xpointer="/current-item/data-i-already-know"/> would be ideal to populate <elem2/>.



--
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: Simple XPL problem

Ryan Puddephatt
Ed,
    Even if xi:include in Orbeon supported xpointer, you would still need to run the SQL Query through an oxf:xinclude processor. I actually like generating queries through XSLT because then I can see exactly what I'm passing (values included) to the database server, which is handy for debugging and keeps the code fairly clear.

Just my 2c

Ryan

Ryan Puddephatt
Software Engineer
 
Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP
 
e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108
w> www.teleflex.com



[hidden email] wrote:
Thanks for your reply Alex, however I was hoping there would be a simpler solution. I've since came up with this solution in my XPL SQL processor...

<sql:execute>
  <sql:query>
    select data_i_want_to_get,
      <sql:param type="xs:string" select="/current-item/data-i-already-know"/> as data_i_already_know
    from table
    where id=<sql:param type="xs:int" select="/current-item/id"/>
  </sql:query>
  <sql:result-set>
    <sql:row-iterator>
      <result>
        <elem1><sql:get-column-value column="data_i_want_to_get"/></elem1>
        <elem2><sql:get-column-value column="data_i_already_know"/></elem2>
      </result>
    </sql:row-iterator>
  </sql:result-set>
</sql:execute>

This isn't ideal (as I'm adding unecessary stuff to my sql), but works. As I mentioned before, a tag like <xi:include href="#instance" xpointer="/current-item/data-i-already-know"/> would be ideal to populate <elem2/>.

  

-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Simple XPL problem

Edpriwer
Could you possibly point me to an example of "generating queries through XSLT"?



--
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: Re: Simple XPL problem

Alessandro Vernet
Administrator
Hi Ed,

If I understand your initial email correctly, rather than generate a
SQL query with XSLT, you would like to add information to the SQL
result. So the flow would be:

1) SQL => SQL result
2) SQL result + other document => XSLT => Combined result

In step 2, you need 2 inputs to your stylesheets. See for instance how
this is done in the attached XPL. The second XSLT takes 2 inputs: the
normal data input, and another input called "xpath", which can from
XPath be accessed with doc('input:xpath').

Alex

On 4/10/07, [hidden email] <[hidden email]> wrote:

> Could you possibly point me to an example of "generating queries through XSLT"?
>
>
>
> --
> 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 Forms - Web 2.0 Forms for the Enterprise
http://www.orbeon.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

run-xpath.xpl (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Simple XPL problem

Edpriwer
Thanks Alex, that's a good way to do it. I'm very new to XForms, but am
understanding it more and more each day - and I'm even starting to like
it =)

Thanks for your help.

Alessandro Vernet wrote:

> Hi Ed,
>
> If I understand your initial email correctly, rather than generate a
> SQL query with XSLT, you would like to add information to the SQL
> result. So the flow would be:
>
> 1) SQL => SQL result
> 2) SQL result + other document => XSLT => Combined result
>
> In step 2, you need 2 inputs to your stylesheets. See for instance how
> this is done in the attached XPL. The second XSLT takes 2 inputs: the
> normal data input, and another input called "xpath", which can from
> XPath be accessed with doc('input:xpath').
>
> Alex
>
> On 4/10/07, [hidden email] <[hidden email]> wrote:
>> Could you possibly point me to an example of "generating queries
>> through XSLT"?
>>
>>
>>
>> --
>> 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
>  


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