Using document() within oxf:xsl processor

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

Using document() within oxf:xsl processor

Hank Ratzesberger
I want to weave together a couple documents,
a "default parameters" that I create using the
Identity Processor with those returned by
the Request Generator.

I was thinking I could reference them within my
stylesheet the same way I do within a pipeline,
I used the identity processor to create the document
'defaults'.  :

<!-- Returns a document with either defaults or the url parameters -->
<p:processor name="oxf:xslt">
  <p:input name="data" href="#defaults"/>
  <p:input name="config">
    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

      <xsl:variable name="parameters" select="document(#request,/parameters)"/>
....

but it produces the error:

XPath syntax exception (XPath syntax error at char 0 on line 0 in {document(#request,/parameters}: Unclosed XQuery pragma) for
expression: document(#request,/parameters)

Well, I attached the xpl file, but I suspect the answer is to
aggregate the data before passing it to xslt.

Regards,
Hank
Goleta, CA


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

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

Re: Using document() within oxf:xsl processor

Erik Bruchez
Administrator
Hank Ratzesberger wrote:

> I want to weave together a couple documents,
> a "default parameters" that I create using the
> Identity Processor with those returned by
> the Request Generator.
>
> I was thinking I could reference them within my
> stylesheet the same way I do within a pipeline,
> I used the identity processor to create the document
> 'defaults'.  :
>
> <!-- Returns a document with either defaults or the url parameters -->
> <p:processor name="oxf:xslt">
>  <p:input name="data" href="#defaults"/>
>  <p:input name="config">
>    <xsl:stylesheet version="1.0"
>        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
>      <xsl:variable name="parameters"
> select="document(#request,/parameters)"/>
> ....
>
> but it produces the error:
>
> XPath syntax exception (XPath syntax error at char 0 on line 0 in
> {document(#request,/parameters}: Unclosed XQuery pragma) for expression:
> document(#request,/parameters)
>
> Well, I attached the xpl file, but I suspect the answer is to
> aggregate the data before passing it to xslt.
Hank, you can use document() or doc(), but these functions take a string
parameter that contains a URI. The first thing to fix is to use single
quotes. The second thing to fix is to actually pass a URI.

The XSLT transformer supports the special "input:" scheme, which gives
you access to processor inputs. You would then write:

   select="document('input:request')/*/parameters"

You also need to connect something to the request input in the XPL:

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

This should do it!

-Erik

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

Re: Using document() within oxf:xsl processor

Hank Ratzesberger
----- Original Message -----
From: "Erik Bruchez" <[hidden email]>
To: <[hidden email]>
Sent: Friday, May 05, 2006 2:48 PM
Subject: Re: [ops-users] Using document() within oxf:xsl processor


> Hank Ratzesberger wrote:
>> I want to weave together a couple documents,
>> a "default parameters" that I create using the
>> Identity Processor with those returned by
>> the Request Generator.
>>
>> I was thinking I could reference them within my
>> stylesheet the same way I do within a pipeline,
>> I used the identity processor to create the document
>> 'defaults'.  :
>>
>> <!-- Returns a document with either defaults or the url parameters -->
>> <p:processor name="oxf:xslt">
>>  <p:input name="data" href="#defaults"/>
>>  <p:input name="config">
>>    <xsl:stylesheet version="1.0"
>>        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>>
>>      <xsl:variable name="parameters"
>> select="document(#request,/parameters)"/>
>> ....
>>
>> but it produces the error:
>>
>> XPath syntax exception (XPath syntax error at char 0 on line 0 in
>> {document(#request,/parameters}: Unclosed XQuery pragma) for expression:
>> document(#request,/parameters)
>>
>> Well, I attached the xpl file, but I suspect the answer is to
>> aggregate the data before passing it to xslt.
>
> Hank, you can use document() or doc(), but these functions take a string
> parameter that contains a URI. The first thing to fix is to use single
> quotes. The second thing to fix is to actually pass a URI.
>
> The XSLT transformer supports the special "input:" scheme, which gives
> you access to processor inputs. You would then write:
>
>   select="document('input:request')/*/parameters"
>
> You also need to connect something to the request input in the XPL:
>
>   <p:input name="request" href="#request"/>
>
> This should do it!
>
> -Erik
>
> --
> Orbeon - XForms Everywhere:
> http://www.orbeon.com/blog/
Aha! thanks Erik.

RTFM http://www.orbeon.com/ops/doc/processors-xslt#user-defined

I'm still struggling though... Does the xmldb:query
processor have user defined inputs?  How do I pass the
params to the query?  Build the query with xslt -- seems
like a problm.

Well, maybe a weekend will bring some insight.

Best,
Hank



--
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: Using document() within oxf:xsl processor

Alessandro  Vernet
Administrator
Hank,

Yes, in general we build the config for the xmldb-query processor
using XSLT. Lately, we have found that in a lot of cases it is very
convenient to just interact with eXist through the REST API. You can
do this directly from XForms and in this case you wouldn't need to use
XSLT to create the query. More on eXist REST API:

http://exist.sourceforge.net/devguide.html

Alex

On 5/5/06, Hank Ratzesberger <[hidden email]> wrote:

> ----- Original Message -----
> From: "Erik Bruchez" <[hidden email]>
> To: <[hidden email]>
> Sent: Friday, May 05, 2006 2:48 PM
> Subject: Re: [ops-users] Using document() within oxf:xsl processor
>
>
> > Hank Ratzesberger wrote:
> >> I want to weave together a couple documents,
> >> a "default parameters" that I create using the
> >> Identity Processor with those returned by
> >> the Request Generator.
> >>
> >> I was thinking I could reference them within my
> >> stylesheet the same way I do within a pipeline,
> >> I used the identity processor to create the document
> >> 'defaults'.  :
> >>
> >> <!-- Returns a document with either defaults or the url parameters -->
> >> <p:processor name="oxf:xslt">
> >>  <p:input name="data" href="#defaults"/>
> >>  <p:input name="config">
> >>    <xsl:stylesheet version="1.0"
> >>        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> >>
> >>      <xsl:variable name="parameters"
> >> select="document(#request,/parameters)"/>
> >> ....
> >>
> >> but it produces the error:
> >>
> >> XPath syntax exception (XPath syntax error at char 0 on line 0 in
> >> {document(#request,/parameters}: Unclosed XQuery pragma) for expression:
> >> document(#request,/parameters)
> >>
> >> Well, I attached the xpl file, but I suspect the answer is to
> >> aggregate the data before passing it to xslt.
> >
> > Hank, you can use document() or doc(), but these functions take a string
> > parameter that contains a URI. The first thing to fix is to use single
> > quotes. The second thing to fix is to actually pass a URI.
> >
> > The XSLT transformer supports the special "input:" scheme, which gives
> > you access to processor inputs. You would then write:
> >
> >   select="document('input:request')/*/parameters"
> >
> > You also need to connect something to the request input in the XPL:
> >
> >   <p:input name="request" href="#request"/>
> >
> > This should do it!
> >
> > -Erik
> >
> > --
> > Orbeon - XForms Everywhere:
> > http://www.orbeon.com/blog/
>
> Aha! thanks Erik.
>
> RTFM http://www.orbeon.com/ops/doc/processors-xslt#user-defined
>
> I'm still struggling though... Does the xmldb:query
> processor have user defined inputs?  How do I pass the
> params to the query?  Build the query with xslt -- seems
> like a problm.
>
> Well, maybe a weekend will bring some insight.
>
> Best,
> Hank
>
>
>
>
> --
> 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