Including multiple external instances

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

Including multiple external instances

Alan Skorkin
Including multiple external instances

Hi,

I was wondering if someone could help me with the following problem.

I need to be able to include multiple instances in a view.

Currently my view includes it's main instance like this:

        <xforms:instance id="text">
                <xi:include href="input:instance"/>
            </xforms:instance>

Which works fine, but I need to include possibly several other instances, which are externally produced (i.e. generated dynamically)

Ideally I need something along the lines of:

        <xforms:instance id="other" src="generate-instance.xpl"/>

This doesn't work (I didn't really expect it to :) ), so the solution that seems to be the best way would be to call an external servlet

which will produce the instance as an xml document.

So far we have been able to get the following to work:

        <xforms:instance id="other" src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>

Unfortunately we have not been able to get this to work when not using an absolute URL i.e. The following doesn't work

        <xforms:instance id="other" src="/servletToGenerateInstance"/>

Even though it should from what I can see in the documentation. The question is, why doesn't the above work?

More generally what is the best way for me to include several dynamically generated external instances in my view?

Preferably without going to an external servlet, but if we have to go to an external servlet, we need access to the same HttpServetRequet object that the

OPS servlet has, how can this be done?

I hope there is a simple way of accomlishing what we require, would appreciate input from anyone.

Thanks,

Alan



--
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: Including multiple external instances

Richard Braman
Message
I wanted to post my guess so I could be on the record with the teachers as thinking right about OPS at least once this week if my answer is correct ;)
 
I think the syntax you put down seems almost right
<xforms:instance id="other" src="generate-instance.xpl"/>
but I think if its a pipeline that you have to "call" the pipeline with some sort of ofx: syntax.
 
If thats not right, my second guess is that you have to call the pipeline to produce the instance in your xpl model file, name the output something, and refer to that using the href syntax you jotted. 
 
Am I right? only time will tell.
 
-----Original Message-----
From: Alan Skorkin [mailto:[hidden email]]
Sent: Thursday, February 16, 2006 11:24 PM
To: [hidden email]
Subject: [ops-users] Including multiple external instances

Hi,

I was wondering if someone could help me with the following problem.

I need to be able to include multiple instances in a view.

Currently my view includes it's main instance like this:

        <xforms:instance id="text">
                <xi:include href="input:instance"/>
            </xforms:instance>

Which works fine, but I need to include possibly several other instances, which are externally produced (i.e. generated dynamically)

Ideally I need something along the lines of:

        <xforms:instance id="other" src="generate-instance.xpl"/>

This doesn't work (I didn't really expect it to :) ), so the solution that seems to be the best way would be to call an external servlet

which will produce the instance as an xml document.

So far we have been able to get the following to work:

        <xforms:instance id="other" src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>

Unfortunately we have not been able to get this to work when not using an absolute URL i.e. The following doesn't work

        <xforms:instance id="other" src="/servletToGenerateInstance"/>

Even though it should from what I can see in the documentation. The question is, why doesn't the above work?

More generally what is the best way for me to include several dynamically generated external instances in my view?

Preferably without going to an external servlet, but if we have to go to an external servlet, we need access to the same HttpServetRequet object that the

OPS servlet has, how can this be done?

I hope there is a simple way of accomlishing what we require, would appreciate input from anyone.

Thanks,

Alan



--
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: Including multiple external instances

Richard Braman
In reply to this post by Alan Skorkin
Message
Actually, it was this one I was waiting to hear your response on.
-----Original Message-----
From: Alan Skorkin [mailto:[hidden email]]
Sent: Thursday, February 16, 2006 11:24 PM
To: [hidden email]
Subject: [ops-users] Including multiple external instances

Hi,

I was wondering if someone could help me with the following problem.

I need to be able to include multiple instances in a view.

Currently my view includes it's main instance like this:

        <xforms:instance id="text">
                <xi:include href="input:instance"/>
            </xforms:instance>

Which works fine, but I need to include possibly several other instances, which are externally produced (i.e. generated dynamically)

Ideally I need something along the lines of:

        <xforms:instance id="other" src="generate-instance.xpl"/>

This doesn't work (I didn't really expect it to :) ), so the solution that seems to be the best way would be to call an external servlet

which will produce the instance as an xml document.

So far we have been able to get the following to work:

        <xforms:instance id="other" src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>

Unfortunately we have not been able to get this to work when not using an absolute URL i.e. The following doesn't work

        <xforms:instance id="other" src="/servletToGenerateInstance"/>

Even though it should from what I can see in the documentation. The question is, why doesn't the above work?

More generally what is the best way for me to include several dynamically generated external instances in my view?

Preferably without going to an external servlet, but if we have to go to an external servlet, we need access to the same HttpServetRequet object that the

OPS servlet has, how can this be done?

I hope there is a simple way of accomlishing what we require, would appreciate input from anyone.

Thanks,

Alan



--
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: Including multiple external instances

Daniel E. Renfer
Oh sure, /my/ post was chopped liver... I see. :)

Anyway, what about the extension function xxforms:call-xpl() ?

http://www.orbeon.com/ops/doc/reference-xforms-ng#ops-extensions

Daniel E. Renfer (http://kronkltd.net/)

On 2/18/06, Richard Braman <[hidden email]> wrote:

>
> Actually, it was this one I was waiting to hear your response on.
>
>
> -----Original Message-----
> From: Alan Skorkin [mailto:[hidden email]]
> Sent: Thursday, February 16, 2006 11:24 PM
> To: [hidden email]
> Subject: [ops-users] Including multiple external instances
>
>
>
> Hi,
>
> I was wondering if someone could help me with the following problem.
>
> I need to be able to include multiple instances in a view.
>
> Currently my view includes it's main instance like this:
>
>         <xforms:instance id="text">
>                 <xi:include href="input:instance"/>
>             </xforms:instance>
>
> Which works fine, but I need to include possibly several other instances,
> which are externally produced (i.e. generated dynamically)
>
> Ideally I need something along the lines of:
>
>         <xforms:instance id="other" src="generate-instance.xpl"/>
>
> This doesn't work (I didn't really expect it to :) ), so the solution that
> seems to be the best way would be to call an external servlet
>
> which will produce the instance as an xml document.
>
> So far we have been able to get the following to work:
>
>         <xforms:instance id="other"
> src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>
>
> Unfortunately we have not been able to get this to work when not using an
> absolute URL i.e. The following doesn't work
>
>         <xforms:instance id="other"
> src="/servletToGenerateInstance"/>
>
> Even though it should from what I can see in the documentation. The question
> is, why doesn't the above work?
>
> More generally what is the best way for me to include several dynamically
> generated external instances in my view?
>
> Preferably without going to an external servlet, but if we have to go to an
> external servlet, we need access to the same HttpServetRequet object that
> the
>
> OPS servlet has, how can this be done?
>
> I hope there is a simple way of accomlishing what we require, would
> appreciate input from anyone.
>
> Thanks,
>
> Alan
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Including multiple external instances

Erik Bruchez
Administrator
In reply to this post by Alan Skorkin
Alan Skorkin wrote:

 > I need to be able to include multiple instances in a view.
 >
 > Currently my view includes it's main instance like this:
 >
 >         <xforms:instance id="text">
 >                 <xi:include href="input:instance"/>
 >             </xforms:instance>
 >
 > Which works fine, but I need to include possibly several other
 > instances, which are externally produced (i.e. generated
 > dynamically)
 >
 > Ideally I need something along the lines of:
 >
 >         <xforms:instance id="other" src="generate-instance.xpl"/>
 >
 > This doesn't work (I didn't really expect it to :) )

It is important to realize why it doesn't work: the "src" attribute
contains a URL, relative or not. As explained in another email
regarding xforms:submission/@action, the URL is resolved against
xml:base attributes and if none, against the URL used to request the
page.

So technically, using "generate-instance.xpl" is not illegal, but you
will have to match that in your page flow to get results, create a
model that extracts the name from the URL, loads and execute the
pipeline, etc. Some work to do!

 > So far we have been able to get the following to work:
 >
 >         <xforms:instance id="other"
 > src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>
 >
 > Unfortunately we have not been able to get this to work when not using
 > an absolute URL i.e. The following doesn't work
 >
 >         <xforms:instance id="other" src="/servletToGenerateInstance"/>
 >
 > Even though it should from what I can see in the documentation. The
 > question is, why doesn't the above work?

This should work. Without more information, I cannot say why it
doesn't in your case.

 > More generally what is the best way for me to include several
 > dynamically generated external instances in my view?

 > Preferably without going to an external servlet, but if we have to
 > go to an external servlet, we need access to the same
 > HttpServetRequet object that the OPS servlet has, how can this be
 > done?

The PFC follows a Model-View-Controller architecture. You can leverage
that capability, i.e.:

o your page model provides the initial XForms instances
o your page view includes these XForms instances

So create a page model that calls the XPL files that produce these
instances, and then aggregate them with something like:

   <p:processor name="oxf:identity">
       <p:input name="data="aggregate('root', #instance1, #instance2,
#instance3)"/>
       <p:output name="data" ref="data"/>
   </p:processor>

Then make sure your page view is an XSLT view (xsl:version="2.0
attribute on the root), and include instances as follows:

   <xforms:instance id="instance1">
     <xsl:copy-of select="/*/*[1]"/>
   </xforms:instance>

   <xforms:instance id="instance2">
     <xsl:copy-of select="/*/*[2]"/>
   </xforms:instance>

   <xforms:instance id="instance3">
     <xsl:copy-of select="/*/*[3]"/>
   </xforms:instance>

Ideally, you could also use XInclude to do this, but this would
require support for the element() and/or xpointer() schemes which is
not available at the moment.

-Erik



--
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: Including multiple external instances

Erik Bruchez
Administrator
In reply to this post by Daniel E. Renfer
Daniel E. Renfer wrote:

 > Anyway, what about the extension function xxforms:call-xpl() ?
 >
 > http://www.orbeon.com/ops/doc/reference-xforms-ng#ops-extensions

I don't see a way to this function to initialize an XForms
instance. You can use it in xforms:bind/@calculate, but the result of
a calculate is always a string, not a complete XML document.

What you can do though is perform submissions upon xforms engine
initialization:

   <xforms:send ev:event="xforms-ready" submission="init-instance-1"/>

and then:

   <xforms:submisssion id="init-instance-1""
     replace="instance" instance="my-instance-1" .../>

But if you can do that, you can problably also just use:

   <xforms:instance id="my-instance-1"
src="/some/url/returning/instance-1"/>

-Erik




--
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: Including multiple external instances

Alan Skorkin
In reply to this post by Alan Skorkin
RE: [ops-users] Including multiple external instances

Thanks Erik,

I'll give this a go!

-----Original Message-----
From: Erik Bruchez [[hidden email]]
Sent: Monday, February 20, 2006 11:06 PM
To: [hidden email]
Subject: Re: [ops-users] Including multiple external instances

Alan Skorkin wrote:

 > I need to be able to include multiple instances in a view.
 >
 > Currently my view includes it's main instance like this:
 >
 >         <xforms:instance id="text">
 >                 <xi:include href="input:instance"/>
 >             </xforms:instance>
 >
 > Which works fine, but I need to include possibly several other  > instances, which are externally produced (i.e. generated  > dynamically)  >  > Ideally I need something along the lines of:

 >
 >         <xforms:instance id="other" src="generate-instance.xpl"/>
 >
 > This doesn't work (I didn't really expect it to :) )

It is important to realize why it doesn't work: the "src" attribute contains a URL, relative or not. As explained in another email regarding xforms:submission/@action, the URL is resolved against xml:base attributes and if none, against the URL used to request the page.

So technically, using "generate-instance.xpl" is not illegal, but you will have to match that in your page flow to get results, create a model that extracts the name from the URL, loads and execute the pipeline, etc. Some work to do!

 > So far we have been able to get the following to work:
 >
 >         <xforms:instance id="other"
 > src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>
 >
 > Unfortunately we have not been able to get this to work when not using  > an absolute URL i.e. The following doesn't work  >

 >         <xforms:instance id="other" src="/servletToGenerateInstance"/>
 >
 > Even though it should from what I can see in the documentation. The  > question is, why doesn't the above work?

This should work. Without more information, I cannot say why it doesn't in your case.

 > More generally what is the best way for me to include several  > dynamically generated external instances in my view?

 > Preferably without going to an external servlet, but if we have to  > go to an external servlet, we need access to the same  > HttpServetRequet object that the OPS servlet has, how can this be  > done?

The PFC follows a Model-View-Controller architecture. You can leverage that capability, i.e.:

o your page model provides the initial XForms instances o your page view includes these XForms instances

So create a page model that calls the XPL files that produce these instances, and then aggregate them with something like:

   <p:processor name="oxf:identity">
       <p:input name="data="aggregate('root', #instance1, #instance2, #instance3)"/>
       <p:output name="data" ref="data"/>
   </p:processor>

Then make sure your page view is an XSLT view (xsl:version="2.0 attribute on the root), and include instances as follows:

   <xforms:instance id="instance1">
     <xsl:copy-of select="/*/*[1]"/>
   </xforms:instance>

   <xforms:instance id="instance2">
     <xsl:copy-of select="/*/*[2]"/>
   </xforms:instance>

   <xforms:instance id="instance3">
     <xsl:copy-of select="/*/*[3]"/>
   </xforms:instance>

Ideally, you could also use XInclude to do this, but this would require support for the element() and/or xpointer() schemes which is not available at the moment.

-Erik



--
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: Including multiple external instances/xform:model location in document?

Richard Braman
Message
Wasnt Pascals question this the same baisc question being asked by Alan Skorkin?
 
The answers given by you and Erik were different, but your sounds better
 
Also I remember having a problem with using src="path".  I was directed to use src="oxf:path/to/file
 
but putting it into the page flow seems much easier

Alex wrote:

It looks like you want to load an instance dynamically when the page is loaded instead of having it defined statically in the XHTML + XForms file. To do this, you don't need to write any JavaScript. Isn't that good news? :)

See for instance the XForms Internationalization example. In i18n-form.xhtml, you will see: <xforms:instance id="i18n" src="i18n-resources"/>. This will load the instance from the "i18n-resources". This is a relative URI which runs i18n-resources.xpl because there is a <page path-info="/xforms-i18n/i18n-resources"

model="i18n-resources.xpl"/> in the page flow.

-----Original Message-----
From: Alan Skorkin [mailto:[hidden email]]
Sent: Monday, February 20, 2006 8:24 PM
To: '[hidden email]'
Subject: RE: [ops-users] Including multiple external instances

Thanks Erik,

I'll give this a go!

-----Original Message-----
From: Erik Bruchez [[hidden email]]
Sent: Monday, February 20, 2006 11:06 PM
To: [hidden email]
Subject: Re: [ops-users] Including multiple external instances

Alan Skorkin wrote:

 > I need to be able to include multiple instances in a view.
 >
 > Currently my view includes it's main instance like this:
 >
 >         <xforms:instance id="text">
 >                 <xi:include href="input:instance"/>
 >             </xforms:instance>
 >
 > Which works fine, but I need to include possibly several other  > instances, which are externally produced (i.e. generated  > dynamically)  >  > Ideally I need something along the lines of:

 >
 >         <xforms:instance id="other" src="generate-instance.xpl"/>
 >
 > This doesn't work (I didn't really expect it to :) )

It is important to realize why it doesn't work: the "src" attribute contains a URL, relative or not. As explained in another email regarding xforms:submission/@action, the URL is resolved against xml:base attributes and if none, against the URL used to request the page.

So technically, using "generate-instance.xpl" is not illegal, but you will have to match that in your page flow to get results, create a model that extracts the name from the URL, loads and execute the pipeline, etc. Some work to do!

 > So far we have been able to get the following to work:
 >
 >         <xforms:instance id="other"
 > src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>
 >
 > Unfortunately we have not been able to get this to work when not using  > an absolute URL i.e. The following doesn't work  >

 >         <xforms:instance id="other" src="/servletToGenerateInstance"/>
 >
 > Even though it should from what I can see in the documentation. The  > question is, why doesn't the above work?

This should work. Without more information, I cannot say why it doesn't in your case.

 > More generally what is the best way for me to include several  > dynamically generated external instances in my view?

 > Preferably without going to an external servlet, but if we have to  > go to an external servlet, we need access to the same  > HttpServetRequet object that the OPS servlet has, how can this be  > done?

The PFC follows a Model-View-Controller architecture. You can leverage that capability, i.e.:

o your page model provides the initial XForms instances o your page view includes these XForms instances

So create a page model that calls the XPL files that produce these instances, and then aggregate them with something like:

   <p:processor name="oxf:identity">
       <p:input name="data="aggregate('root', #instance1, #instance2, #instance3)"/>
       <p:output name="data" ref="data"/>
   </p:processor>

Then make sure your page view is an XSLT view (xsl:version="2.0 attribute on the root), and include instances as follows:

   <xforms:instance id="instance1">
     <xsl:copy-of select="/*/*[1]"/>
   </xforms:instance>

   <xforms:instance id="instance2">
     <xsl:copy-of select="/*/*[2]"/>
   </xforms:instance>

   <xforms:instance id="instance3">
     <xsl:copy-of select="/*/*[3]"/>
   </xforms:instance>

Ideally, you could also use XInclude to do this, but this would require support for the element() and/or xpointer() schemes which is not available at the moment.

-Erik



--
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: Including multiple external instances/xform:model location in document?

Alessandro  Vernet
Administrator
Richard,

To clarify (if at all needed!):

If you don't put a scheme in the URI you have in the <xforms:instance
src="...">, the URI is relative to the current page, so it will be as
is you were requesting this from the browser, which means that your
request will hit the page flow controller. This is typically useful
when you want to generate an instance dynamically and that you can
write the logic to generate that instance in an XPL file.

Using a URI of the form oxf:/... is also possible and is typically
useful when the instance is static and stored in a separate file.

Alex

On 3/2/06, Richard Braman <[hidden email]> wrote:

>
> Wasnt Pascals question this the same baisc question being asked by Alan
> Skorkin?
>
> The answers given by you and Erik were different, but your sounds better
>
> Also I remember having a problem with using src="path".  I was directed to
> use src="oxf:path/to/file
>
> but putting it into the page flow seems much easier
>
>
> Alex wrote:
>
> It looks like you want to load an instance dynamically when the page is
> loaded instead of having it defined statically in the XHTML + XForms file.
> To do this, you don't need to write any JavaScript. Isn't that good news? :)
>
> See for instance the XForms Internationalization example. In
> i18n-form.xhtml, you will see: <xforms:instance id="i18n"
> src="i18n-resources"/>. This will load the instance from the
> "i18n-resources". This is a relative URI which runs i18n-resources.xpl
> because there is a <page
> path-info="/xforms-i18n/i18n-resources"
>
> model="i18n-resources.xpl"/> in the page flow.
>
>
> -----Original Message-----
> From: Alan Skorkin [mailto:[hidden email]]
> Sent: Monday, February 20, 2006 8:24 PM
> To: '[hidden email]'
> Subject: RE: [ops-users] Including multiple external instances
>
>
>
> Thanks Erik,
>
> I'll give this a go!
>
> -----Original Message-----
> From: Erik Bruchez [mailto:[hidden email]]
> Sent: Monday, February 20, 2006 11:06 PM
> To: [hidden email]
> Subject: Re: [ops-users] Including multiple external instances
>
> Alan Skorkin wrote:
>
>  > I need to be able to include multiple instances in a view.
>  >
>  > Currently my view includes it's main instance like this:
>  >
>  >         <xforms:instance id="text">
>  >                 <xi:include href="input:instance"/>
>  >             </xforms:instance>
>  >
>  > Which works fine, but I need to include possibly several other  >
> instances, which are externally produced (i.e. generated  > dynamically)  >
> > Ideally I need something along the lines of:
>
>  >
>  >         <xforms:instance id="other" src="generate-instance.xpl"/>
>  >
>  > This doesn't work (I didn't really expect it to :) )
>
> It is important to realize why it doesn't work: the "src" attribute contains
> a URL, relative or not. As explained in another email regarding
> xforms:submission/@action, the URL is resolved against xml:base attributes
> and if none, against the URL used to request the page.
>
> So technically, using "generate-instance.xpl" is not illegal, but you will
> have to match that in your page flow to get results, create a model that
> extracts the name from the URL, loads and execute the pipeline, etc. Some
> work to do!
>
>  > So far we have been able to get the following to work:
>  >
>  >         <xforms:instance id="other"
>  >
> src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>
>  >
>  > Unfortunately we have not been able to get this to work when not using  >
> an absolute URL i.e. The following doesn't work  >
>
>  >         <xforms:instance id="other"
> src="/servletToGenerateInstance"/>
>  >
>  > Even though it should from what I can see in the documentation. The  >
> question is, why doesn't the above work?
>
> This should work. Without more information, I cannot say why it doesn't in
> your case.
>
>  > More generally what is the best way for me to include several  >
> dynamically generated external instances in my view?
>
>  > Preferably without going to an external servlet, but if we have to  > go
> to an external servlet, we need access to the same  > HttpServetRequet
> object that the OPS servlet has, how can this be  > done?
>
> The PFC follows a Model-View-Controller architecture. You can leverage that
> capability, i.e.:
>
> o your page model provides the initial XForms instances o your page view
> includes these XForms instances
>
> So create a page model that calls the XPL files that produce these
> instances, and then aggregate them with something like:
>
>    <p:processor name="oxf:identity">
>        <p:input name="data="aggregate('root', #instance1, #instance2,
> #instance3)"/>
>        <p:output name="data" ref="data"/>
>    </p:processor>
>
> Then make sure your page view is an XSLT view (xsl:version="2.0 attribute on
> the root), and include instances as follows:
>
>    <xforms:instance id="instance1">
>      <xsl:copy-of select="/*/*[1]"/>
>    </xforms:instance>
>
>    <xforms:instance id="instance2">
>      <xsl:copy-of select="/*/*[2]"/>
>    </xforms:instance>
>
>    <xforms:instance id="instance3">
>      <xsl:copy-of select="/*/*[3]"/>
>    </xforms:instance>
>
> Ideally, you could also use XInclude to do this, but this would require
> support for the element() and/or xpointer() schemes which is not available
> at the moment.
>
> -Erik
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

RE: Including multiple external instances/xform:model location in document?

Richard Braman
I understand that,  I am just saying that this advice differed from the
advice Erik gave Alan Skorkin (see message reproduced at bottom).  I
think Alan was just trying to accomplish the same thing as Pascal, and
your solution makes more sense, to me at least.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Alessandro Vernet
Sent: Thursday, March 02, 2006 9:21 PM
To: [hidden email]
Subject: Re: [ops-users] Including multiple external
instances/xform:model location in document?


Richard,

To clarify (if at all needed!):

If you don't put a scheme in the URI you have in the <xforms:instance
src="...">, the URI is relative to the current page, so it will be as is
you were requesting this from the browser, which means that your request
will hit the page flow controller. This is typically useful when you
want to generate an instance dynamically and that you can write the
logic to generate that instance in an XPL file.

Using a URI of the form oxf:/... is also possible and is typically
useful when the instance is static and stored in a separate file.

Alex

On 3/2/06, Richard Braman <[hidden email]> wrote:

>
> Wasnt Pascals question this the same baisc question being asked by
> Alan Skorkin?
>
> The answers given by you and Erik were different, but your sounds
> better
>
> Also I remember having a problem with using src="path".  I was
> directed to use src="oxf:path/to/file
>
> but putting it into the page flow seems much easier
>
>
> Alex wrote:
>
> It looks like you want to load an instance dynamically when the page
> is loaded instead of having it defined statically in the XHTML +
> XForms file. To do this, you don't need to write any JavaScript. Isn't

> that good news? :)
>
> See for instance the XForms Internationalization example. In
> i18n-form.xhtml, you will see: <xforms:instance id="i18n"
> src="i18n-resources"/>. This will load the instance from the
> "i18n-resources". This is a relative URI which runs i18n-resources.xpl

> because there is a <page path-info="/xforms-i18n/i18n-resources"
>
> model="i18n-resources.xpl"/> in the page flow.
>
>
> -----Original Message-----
> From: Alan Skorkin [mailto:[hidden email]]
> Sent: Monday, February 20, 2006 8:24 PM
> To: '[hidden email]'
> Subject: RE: [ops-users] Including multiple external instances
>
>
>
> Thanks Erik,
>
> I'll give this a go!
>
> -----Original Message-----
> From: Erik Bruchez [mailto:[hidden email]]
> Sent: Monday, February 20, 2006 11:06 PM
> To: [hidden email]
> Subject: Re: [ops-users] Including multiple external instances
>
> Alan Skorkin wrote:
>
>  > I need to be able to include multiple instances in a view.  >
>  > Currently my view includes it's main instance like this:
>  >
>  >         <xforms:instance id="text">
>  >                 <xi:include href="input:instance"/>
>  >             </xforms:instance>
>  >
>  > Which works fine, but I need to include possibly several other  >
> instances, which are externally produced (i.e. generated  >
dynamically)  >
> > Ideally I need something along the lines of:
>
>  >
>  >         <xforms:instance id="other" src="generate-instance.xpl"/>
>  >
>  > This doesn't work (I didn't really expect it to :) )
>
> It is important to realize why it doesn't work: the "src" attribute
contains
> a URL, relative or not. As explained in another email regarding
> xforms:submission/@action, the URL is resolved against xml:base
attributes
> and if none, against the URL used to request the page.
>
> So technically, using "generate-instance.xpl" is not illegal, but you
will
> have to match that in your page flow to get results, create a model
that
> extracts the name from the URL, loads and execute the pipeline, etc.
Some
> work to do!
>
>  > So far we have been able to get the following to work:
>  >
>  >         <xforms:instance id="other"
>  >
>
src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>
>  >
>  > Unfortunately we have not been able to get this to work when not
using  >

> an absolute URL i.e. The following doesn't work  >
>
>  >         <xforms:instance id="other"
> src="/servletToGenerateInstance"/>
>  >
>  > Even though it should from what I can see in the documentation. The
>
> question is, why doesn't the above work?
>
> This should work. Without more information, I cannot say why it
doesn't in

> your case.
>
>  > More generally what is the best way for me to include several  >
> dynamically generated external instances in my view?
>
>  > Preferably without going to an external servlet, but if we have to
> go
> to an external servlet, we need access to the same  > HttpServetRequet
> object that the OPS servlet has, how can this be  > done?
>
> The PFC follows a Model-View-Controller architecture. You can leverage
that
> capability, i.e.:
>
> o your page model provides the initial XForms instances o your page
view

> includes these XForms instances
>
> So create a page model that calls the XPL files that produce these
> instances, and then aggregate them with something like:
>
>    <p:processor name="oxf:identity">
>        <p:input name="data="aggregate('root', #instance1, #instance2,
> #instance3)"/>
>        <p:output name="data" ref="data"/>
>    </p:processor>
>
> Then make sure your page view is an XSLT view (xsl:version="2.0
attribute on

> the root), and include instances as follows:
>
>    <xforms:instance id="instance1">
>      <xsl:copy-of select="/*/*[1]"/>
>    </xforms:instance>
>
>    <xforms:instance id="instance2">
>      <xsl:copy-of select="/*/*[2]"/>
>    </xforms:instance>
>
>    <xforms:instance id="instance3">
>      <xsl:copy-of select="/*/*[3]"/>
>    </xforms:instance>
>
> Ideally, you could also use XInclude to do this, but this would
require
> support for the element() and/or xpointer() schemes which is not
available
> at the moment.
>
> -Erik
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

RE: Including multiple external instances/xform:model location in document?

Richard Braman
I gues it was the same advice, it was just a littl more confusing.  I
was following this thread because I have the same problem.

-----Original Message-----
From: Richard Braman [mailto:[hidden email]]
Sent: Thursday, March 02, 2006 9:13 PM
To: [hidden email]
Subject: RE: [ops-users] Including multiple external
instances/xform:model location in document?


I understand that,  I am just saying that this advice differed from the
advice Erik gave Alan Skorkin (see message reproduced at bottom).  I
think Alan was just trying to accomplish the same thing as Pascal, and
your solution makes more sense, to me at least.

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of
Alessandro Vernet
Sent: Thursday, March 02, 2006 9:21 PM
To: [hidden email]
Subject: Re: [ops-users] Including multiple external
instances/xform:model location in document?


Richard,

To clarify (if at all needed!):

If you don't put a scheme in the URI you have in the <xforms:instance
src="...">, the URI is relative to the current page, so it will be as is
you were requesting this from the browser, which means that your request
will hit the page flow controller. This is typically useful when you
want to generate an instance dynamically and that you can write the
logic to generate that instance in an XPL file.

Using a URI of the form oxf:/... is also possible and is typically
useful when the instance is static and stored in a separate file.

Alex

On 3/2/06, Richard Braman <[hidden email]> wrote:

>
> Wasnt Pascals question this the same baisc question being asked by
> Alan Skorkin?
>
> The answers given by you and Erik were different, but your sounds
> better
>
> Also I remember having a problem with using src="path".  I was
> directed to use src="oxf:path/to/file
>
> but putting it into the page flow seems much easier
>
>
> Alex wrote:
>
> It looks like you want to load an instance dynamically when the page
> is loaded instead of having it defined statically in the XHTML +
> XForms file. To do this, you don't need to write any JavaScript. Isn't

> that good news? :)
>
> See for instance the XForms Internationalization example. In
> i18n-form.xhtml, you will see: <xforms:instance id="i18n"
> src="i18n-resources"/>. This will load the instance from the
> "i18n-resources". This is a relative URI which runs i18n-resources.xpl

> because there is a <page path-info="/xforms-i18n/i18n-resources"
>
> model="i18n-resources.xpl"/> in the page flow.
>
>
> -----Original Message-----
> From: Alan Skorkin [mailto:[hidden email]]
> Sent: Monday, February 20, 2006 8:24 PM
> To: '[hidden email]'
> Subject: RE: [ops-users] Including multiple external instances
>
>
>
> Thanks Erik,
>
> I'll give this a go!
>
> -----Original Message-----
> From: Erik Bruchez [mailto:[hidden email]]
> Sent: Monday, February 20, 2006 11:06 PM
> To: [hidden email]
> Subject: Re: [ops-users] Including multiple external instances
>
> Alan Skorkin wrote:
>
>  > I need to be able to include multiple instances in a view.  >  >
> Currently my view includes it's main instance like this:  >
>  >         <xforms:instance id="text">
>  >                 <xi:include href="input:instance"/>
>  >             </xforms:instance>
>  >
>  > Which works fine, but I need to include possibly several other  >
> instances, which are externally produced (i.e. generated  >
dynamically)  >
> > Ideally I need something along the lines of:
>
>  >
>  >         <xforms:instance id="other" src="generate-instance.xpl"/>
>  >
>  > This doesn't work (I didn't really expect it to :) )
>
> It is important to realize why it doesn't work: the "src" attribute
contains
> a URL, relative or not. As explained in another email regarding
> xforms:submission/@action, the URL is resolved against xml:base
attributes
> and if none, against the URL used to request the page.
>
> So technically, using "generate-instance.xpl" is not illegal, but you
will
> have to match that in your page flow to get results, create a model
that
> extracts the name from the URL, loads and execute the pipeline, etc.
Some
> work to do!
>
>  > So far we have been able to get the following to work:
>  >
>  >         <xforms:instance id="other"
>  >
>
src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>
>  >
>  > Unfortunately we have not been able to get this to work when not
using  >

> an absolute URL i.e. The following doesn't work  >
>
>  >         <xforms:instance id="other"
> src="/servletToGenerateInstance"/>
>  >
>  > Even though it should from what I can see in the documentation. The
>
> question is, why doesn't the above work?
>
> This should work. Without more information, I cannot say why it
doesn't in

> your case.
>
>  > More generally what is the best way for me to include several  >
> dynamically generated external instances in my view?
>
>  > Preferably without going to an external servlet, but if we have to
> go to an external servlet, we need access to the same  >
> HttpServetRequet object that the OPS servlet has, how can this be  >
> done?
>
> The PFC follows a Model-View-Controller architecture. You can leverage
that
> capability, i.e.:
>
> o your page model provides the initial XForms instances o your page
view

> includes these XForms instances
>
> So create a page model that calls the XPL files that produce these
> instances, and then aggregate them with something like:
>
>    <p:processor name="oxf:identity">
>        <p:input name="data="aggregate('root', #instance1, #instance2,
> #instance3)"/>
>        <p:output name="data" ref="data"/>
>    </p:processor>
>
> Then make sure your page view is an XSLT view (xsl:version="2.0
attribute on

> the root), and include instances as follows:
>
>    <xforms:instance id="instance1">
>      <xsl:copy-of select="/*/*[1]"/>
>    </xforms:instance>
>
>    <xforms:instance id="instance2">
>      <xsl:copy-of select="/*/*[2]"/>
>    </xforms:instance>
>
>    <xforms:instance id="instance3">
>      <xsl:copy-of select="/*/*[3]"/>
>    </xforms:instance>
>
> Ideally, you could also use XInclude to do this, but this would
require
> support for the element() and/or xpointer() schemes which is not
available
> at the moment.
>
> -Erik
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Including multiple external instances/xform:model location in document?

Pascal Heus
Alex, Richard,
very much appreciate your feedback and suggestions, will investigate asap. My issue is that I wrote a basic javascript/ajax based application development framework in which various windows, layouts and views are being loaded dynamically and taken in and out of a single web page document. When dealing with xforms, I therefore need to move the instances accordingly in the head element. As a temporary solution, I'm currently simply embedding the full xforms (head+body) in an iframe element. This works but behaves as an independent document. I would like down the road to have everything in the main document. Will let you know if I come up with a decent solution. Looking at the OPS scripts also gave me the opportunity to discover sarissa who looks like a pretty neat JS package. The i18n example you pointed out is also very useful as my apps need to support multiple languages.
Many thanks again for your assistance.
cheers,
<p/>

Richard Braman wrote:
I gues it was the same advice, it was just a littl more confusing.  I
was following this thread because I have the same problem.

-----Original Message-----
From: Richard Braman [[hidden email]] 
Sent: Thursday, March 02, 2006 9:13 PM
To: [hidden email]
Subject: RE: [ops-users] Including multiple external
instances/xform:model location in document?


I understand that,  I am just saying that this advice differed from the
advice Erik gave Alan Skorkin (see message reproduced at bottom).  I
think Alan was just trying to accomplish the same thing as Pascal, and
your solution makes more sense, to me at least.

-----Original Message-----
From: [hidden email] [[hidden email]] On Behalf Of
Alessandro Vernet
Sent: Thursday, March 02, 2006 9:21 PM
To: [hidden email]
Subject: Re: [ops-users] Including multiple external
instances/xform:model location in document?


Richard,

To clarify (if at all needed!):

If you don't put a scheme in the URI you have in the <xforms:instance
src="...">, the URI is relative to the current page, so it will be as is
you were requesting this from the browser, which means that your request
will hit the page flow controller. This is typically useful when you
want to generate an instance dynamically and that you can write the
logic to generate that instance in an XPL file.

Using a URI of the form oxf:/... is also possible and is typically
useful when the instance is static and stored in a separate file.

Alex

On 3/2/06, Richard Braman [hidden email] wrote:
  
Wasnt Pascals question this the same baisc question being asked by
Alan Skorkin?

The answers given by you and Erik were different, but your sounds
better

Also I remember having a problem with using src="path".  I was
directed to use src="oxf:path/to/file

but putting it into the page flow seems much easier


Alex wrote:

It looks like you want to load an instance dynamically when the page
is loaded instead of having it defined statically in the XHTML + 
XForms file. To do this, you don't need to write any JavaScript. Isn't
    

  
that good news? :)

See for instance the XForms Internationalization example. In
i18n-form.xhtml, you will see: <xforms:instance id="i18n" 
src="i18n-resources"/>. This will load the instance from the 
"i18n-resources". This is a relative URI which runs i18n-resources.xpl
    

  
because there is a <page path-info="/xforms-i18n/i18n-resources"

model="i18n-resources.xpl"/> in the page flow.


-----Original Message-----
From: Alan Skorkin [[hidden email]]
Sent: Monday, February 20, 2006 8:24 PM
To: '[hidden email]'
Subject: RE: [ops-users] Including multiple external instances



Thanks Erik,

I'll give this a go!

-----Original Message-----
From: Erik Bruchez [[hidden email]]
Sent: Monday, February 20, 2006 11:06 PM
To: [hidden email]
Subject: Re: [ops-users] Including multiple external instances

Alan Skorkin wrote:

 > I need to be able to include multiple instances in a view.  >  > 
Currently my view includes it's main instance like this:  >
 >         <xforms:instance id="text">
 >                 <xi:include href="input:instance"/>
 >             </xforms:instance>
 >
 > Which works fine, but I need to include possibly several other  >
instances, which are externally produced (i.e. generated  >
    
dynamically)  >
  
Ideally I need something along the lines of:
      
 >
 >         <xforms:instance id="other" src="generate-instance.xpl"/>
 >
 > This doesn't work (I didn't really expect it to :) )

It is important to realize why it doesn't work: the "src" attribute
    
contains
  
a URL, relative or not. As explained in another email regarding 
xforms:submission/@action, the URL is resolved against <a class="moz-txt-link-freetext" href="xml:base">xml:base
    
attributes
  
and if none, against the URL used to request the page.

So technically, using "generate-instance.xpl" is not illegal, but you
    
will
  
have to match that in your page flow to get results, create a model
    
that
  
extracts the name from the URL, loads and execute the pipeline, etc.
    
Some
  
work to do!

 > So far we have been able to get the following to work:
 >
 >         <xforms:instance id="other"
 >

    
src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>
  
 >
 > Unfortunately we have not been able to get this to work when not
    
using  >
  
an absolute URL i.e. The following doesn't work  >

 >         <xforms:instance id="other"
src="/servletToGenerateInstance"/>
 >
 > Even though it should from what I can see in the documentation. The

question is, why doesn't the above work?

This should work. Without more information, I cannot say why it
    
doesn't in
  
your case.

 > More generally what is the best way for me to include several  > 
dynamically generated external instances in my view?

 > Preferably without going to an external servlet, but if we have to 
go to an external servlet, we need access to the same  > 
HttpServetRequet object that the OPS servlet has, how can this be  > 
done?

The PFC follows a Model-View-Controller architecture. You can leverage
    
that
  
capability, i.e.:

o your page model provides the initial XForms instances o your page
    
view
  
includes these XForms instances

So create a page model that calls the XPL files that produce these 
instances, and then aggregate them with something like:

   <p:processor name="oxf:identity">
       <p:input name="data="aggregate('root', #instance1, #instance2, 
#instance3)"/>
       <p:output name="data" ref="data"/>
   </p:processor>

Then make sure your page view is an XSLT view (xsl:version="2.0
    
attribute on
  
the root), and include instances as follows:

   <xforms:instance id="instance1">
     <xsl:copy-of select="/*/*[1]"/>
   </xforms:instance>

   <xforms:instance id="instance2">
     <xsl:copy-of select="/*/*[2]"/>
   </xforms:instance>

   <xforms:instance id="instance3">
     <xsl:copy-of select="/*/*[3]"/>
   </xforms:instance>

Ideally, you could also use XInclude to do this, but this would
    
require
  
support for the element() and/or xpointer() schemes which is not
    
available
  
at the moment.

-Erik

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

    


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

Loading xform dynamically

Pascal Heus
In reply to this post by Richard Braman
Alex:
Tried a few things based on the discussion below:

This work:
<xforms:instance src="http://localhost:8888/ddi/user/accountForm"/>

But if I try:
<xforms:instance src="oxf:ddi/user/accountForm"/>
or <xforms:instance src="oxf:/ddi/user/accountForm"/>
I get an "xforms:submission: submission URL scheme not supported: oxf" error.

Relative URL path seem to fail as well:
<xforms:instance src="../accountForm"/>
results in "Response cannot be null"

- The form is loaded in the "http://localhost:8888/ddi/user/account" page
- /ddi/user/acountForm in the page flow points to a xpl that generates the form
- I'm running ops-3.0.0.200601132127 on Tomcat 4.1 under Eclipse

I may have missed something...?

thanks
<p/>

Richard Braman wrote:
I gues it was the same advice, it was just a littl more confusing.  I
was following this thread because I have the same problem.

-----Original Message-----
From: Richard Braman [[hidden email]] 
Sent: Thursday, March 02, 2006 9:13 PM
To: [hidden email]
Subject: RE: [ops-users] Including multiple external
instances/xform:model location in document?


I understand that,  I am just saying that this advice differed from the
advice Erik gave Alan Skorkin (see message reproduced at bottom).  I
think Alan was just trying to accomplish the same thing as Pascal, and
your solution makes more sense, to me at least.

-----Original Message-----
From: [hidden email] [[hidden email]] On Behalf Of
Alessandro Vernet
Sent: Thursday, March 02, 2006 9:21 PM
To: [hidden email]
Subject: Re: [ops-users] Including multiple external
instances/xform:model location in document?


Richard,

To clarify (if at all needed!):

If you don't put a scheme in the URI you have in the <xforms:instance
src="...">, the URI is relative to the current page, so it will be as is
you were requesting this from the browser, which means that your request
will hit the page flow controller. This is typically useful when you
want to generate an instance dynamically and that you can write the
logic to generate that instance in an XPL file.

Using a URI of the form oxf:/... is also possible and is typically
useful when the instance is static and stored in a separate file.

Alex

On 3/2/06, Richard Braman [hidden email] wrote:
  
Wasnt Pascals question this the same baisc question being asked by
Alan Skorkin?

The answers given by you and Erik were different, but your sounds
better

Also I remember having a problem with using src="path".  I was
directed to use src="oxf:path/to/file

but putting it into the page flow seems much easier


Alex wrote:

It looks like you want to load an instance dynamically when the page
is loaded instead of having it defined statically in the XHTML + 
XForms file. To do this, you don't need to write any JavaScript. Isn't
    

  
that good news? :)

See for instance the XForms Internationalization example. In
i18n-form.xhtml, you will see: <xforms:instance id="i18n" 
src="i18n-resources"/>. This will load the instance from the 
"i18n-resources". This is a relative URI which runs i18n-resources.xpl
    

  
because there is a <page path-info="/xforms-i18n/i18n-resources"

model="i18n-resources.xpl"/> in the page flow.


-----Original Message-----
From: Alan Skorkin [[hidden email]]
Sent: Monday, February 20, 2006 8:24 PM
To: '[hidden email]'
Subject: RE: [ops-users] Including multiple external instances



Thanks Erik,

I'll give this a go!

-----Original Message-----
From: Erik Bruchez [[hidden email]]
Sent: Monday, February 20, 2006 11:06 PM
To: [hidden email]
Subject: Re: [ops-users] Including multiple external instances

Alan Skorkin wrote:

 > I need to be able to include multiple instances in a view.  >  > 
Currently my view includes it's main instance like this:  >
 >         <xforms:instance id="text">
 >                 <xi:include href="input:instance"/>
 >             </xforms:instance>
 >
 > Which works fine, but I need to include possibly several other  >
instances, which are externally produced (i.e. generated  >
    
dynamically)  >
  
Ideally I need something along the lines of:
      
 >
 >         <xforms:instance id="other" src="generate-instance.xpl"/>
 >
 > This doesn't work (I didn't really expect it to :) )

It is important to realize why it doesn't work: the "src" attribute
    
contains
  
a URL, relative or not. As explained in another email regarding 
xforms:submission/@action, the URL is resolved against <a class="moz-txt-link-freetext" href="xml:base">xml:base
    
attributes
  
and if none, against the URL used to request the page.

So technically, using "generate-instance.xpl" is not illegal, but you
    
will
  
have to match that in your page flow to get results, create a model
    
that
  
extracts the name from the URL, loads and execute the pipeline, etc.
    
Some
  
work to do!

 > So far we have been able to get the following to work:
 >
 >         <xforms:instance id="other"
 >

    
src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>
  
 >
 > Unfortunately we have not been able to get this to work when not
    
using  >
  
an absolute URL i.e. The following doesn't work  >

 >         <xforms:instance id="other"
src="/servletToGenerateInstance"/>
 >
 > Even though it should from what I can see in the documentation. The

question is, why doesn't the above work?

This should work. Without more information, I cannot say why it
    
doesn't in
  
your case.

 > More generally what is the best way for me to include several  > 
dynamically generated external instances in my view?

 > Preferably without going to an external servlet, but if we have to 
go to an external servlet, we need access to the same  > 
HttpServetRequet object that the OPS servlet has, how can this be  > 
done?

The PFC follows a Model-View-Controller architecture. You can leverage
    
that
  
capability, i.e.:

o your page model provides the initial XForms instances o your page
    
view
  
includes these XForms instances

So create a page model that calls the XPL files that produce these 
instances, and then aggregate them with something like:

   <p:processor name="oxf:identity">
       <p:input name="data="aggregate('root', #instance1, #instance2, 
#instance3)"/>
       <p:output name="data" ref="data"/>
   </p:processor>

Then make sure your page view is an XSLT view (xsl:version="2.0
    
attribute on
  
the root), and include instances as follows:

   <xforms:instance id="instance1">
     <xsl:copy-of select="/*/*[1]"/>
   </xforms:instance>

   <xforms:instance id="instance2">
     <xsl:copy-of select="/*/*[2]"/>
   </xforms:instance>

   <xforms:instance id="instance3">
     <xsl:copy-of select="/*/*[3]"/>
   </xforms:instance>

Ideally, you could also use XInclude to do this, but this would
    
require
  
support for the element() and/or xpointer() schemes which is not
    
available
  
at the moment.

-Erik

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

    


--
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: [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: Loading xform dynamically

Alessandro  Vernet
Administrator
Hi Pascal,

A URI with no scheme should work as well. The URI can either be
absolute (start with /) or relative. Note that if it is absolute, the
context path will be added for you. So you should have:

<xforms:instance src="/user/account" page"/>

A relative URI should work as well. In that case the value of the
"src" attribute will depends on the URI of the page where you have
that XForms code. Let us know if that solves the problem.

Alex

On 3/9/06, Pascal Heus <[hidden email]> wrote:

>  Alex:
>  Tried a few things based on the discussion below:
>
>  This work:
>  <xforms:instance
> src="http://localhost:8888/ddi/user/accountForm"/>
>
>  But if I try:
>  <xforms:instance src="oxf:ddi/user/accountForm"/>
>  or <xforms:instance src="oxf:/ddi/user/accountForm"/>
>  I get an "xforms:submission: submission URL scheme not supported: oxf"
> error.
>
>  Relative URL path seem to fail as well:
>  <xforms:instance src="../accountForm"/>
>  results in "Response cannot be null"
>
>  - The form is loaded in the
> "http://localhost:8888/ddi/user/account" page
>  - /ddi/user/acountForm in the page flow points to a xpl that generates the
> form
>  - I'm running ops-3.0.0.200601132127 on Tomcat 4.1 under Eclipse
>
>  I may have missed something...?
>
>  thanks
>  <p/>
>
>  Richard Braman wrote:
>  I gues it was the same advice, it was just a littl more confusing. I
> was following this thread because I have the same problem.
>
> -----Original Message-----
> From: Richard Braman [mailto:[hidden email]]
> Sent: Thursday, March 02, 2006 9:13 PM
> To: [hidden email]
> Subject: RE: [ops-users] Including multiple external
> instances/xform:model location in document?
>
>
> I understand that, I am just saying that this advice differed from the
> advice Erik gave Alan Skorkin (see message reproduced at bottom). I
> think Alan was just trying to accomplish the same thing as Pascal, and
> your solution makes more sense, to me at least.
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of
> Alessandro Vernet
> Sent: Thursday, March 02, 2006 9:21 PM
> To: [hidden email]
> Subject: Re: [ops-users] Including multiple external
> instances/xform:model location in document?
>
>
> Richard,
>
> To clarify (if at all needed!):
>
> If you don't put a scheme in the URI you have in the <xforms:instance
> src="...">, the URI is relative to the current page, so it will be as is
> you were requesting this from the browser, which means that your request
> will hit the page flow controller. This is typically useful when you
> want to generate an instance dynamically and that you can write the
> logic to generate that instance in an XPL file.
>
> Using a URI of the form oxf:/... is also possible and is typically
> useful when the instance is static and stored in a separate file.
>
> Alex
>
> On 3/2/06, Richard Braman <[hidden email]> wrote:
>
>
>  Wasnt Pascals question this the same baisc question being asked by
> Alan Skorkin?
>
> The answers given by you and Erik were different, but your sounds
> better
>
> Also I remember having a problem with using src="path". I was
> directed to use src="oxf:path/to/file
>
> but putting it into the page flow seems much easier
>
>
> Alex wrote:
>
> It looks like you want to load an instance dynamically when the page
> is loaded instead of having it defined statically in the XHTML +
> XForms file. To do this, you don't need to write any JavaScript. Isn't
>
>
>
>  that good news? :)
>
> See for instance the XForms Internationalization example. In
> i18n-form.xhtml, you will see: <xforms:instance id="i18n"
> src="i18n-resources"/>. This will load the instance from the
> "i18n-resources". This is a relative URI which runs i18n-resources.xpl
>
>
>
>  because there is a <page
> path-info="/xforms-i18n/i18n-resources"
>
> model="i18n-resources.xpl"/> in the page flow.
>
>
> -----Original Message-----
> From: Alan Skorkin [mailto:[hidden email]]
> Sent: Monday, February 20, 2006 8:24 PM
> To: '[hidden email]'
> Subject: RE: [ops-users] Including multiple external instances
>
>
>
> Thanks Erik,
>
> I'll give this a go!
>
> -----Original Message-----
> From: Erik Bruchez [mailto:[hidden email]]
> Sent: Monday, February 20, 2006 11:06 PM
> To: [hidden email]
> Subject: Re: [ops-users] Including multiple external instances
>
> Alan Skorkin wrote:
>
>  > I need to be able to include multiple instances in a view. > >
> Currently my view includes it's main instance like this: >
>  > <xforms:instance id="text">
>  > <xi:include href="input:instance"/>
>  > </xforms:instance>
>  >
>  > Which works fine, but I need to include possibly several other >
> instances, which are externally produced (i.e. generated >
>
>  dynamically) >
>
>
>
>  Ideally I need something along the lines of:
>
>  >
>  > <xforms:instance id="other" src="generate-instance.xpl"/>
>  >
>  > This doesn't work (I didn't really expect it to :) )
>
> It is important to realize why it doesn't work: the "src" attribute
>
>  contains
>
>
>  a URL, relative or not. As explained in another email regarding
> xforms:submission/@action, the URL is resolved against xml:base
>
>  attributes
>
>
>  and if none, against the URL used to request the page.
>
> So technically, using "generate-instance.xpl" is not illegal, but you
>
>  will
>
>
>  have to match that in your page flow to get results, create a model
>
>  that
>
>
>  extracts the name from the URL, loads and execute the pipeline, etc.
>
>  Some
>
>
>  work to do!
>
>  > So far we have been able to get the following to work:
>  >
>  > <xforms:instance id="other"
>  >
>
>
> src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>
>
>
>  >
>  > Unfortunately we have not been able to get this to work when not
>
>  using >
>
>
>  an absolute URL i.e. The following doesn't work >
>
>  > <xforms:instance id="other"
> src="/servletToGenerateInstance"/>
>  >
>  > Even though it should from what I can see in the documentation. The
>
> question is, why doesn't the above work?
>
> This should work. Without more information, I cannot say why it
>
>  doesn't in
>
>
>  your case.
>
>  > More generally what is the best way for me to include several >
> dynamically generated external instances in my view?
>
>  > Preferably without going to an external servlet, but if we have to
> go to an external servlet, we need access to the same >
> HttpServetRequet object that the OPS servlet has, how can this be >
> done?
>
> The PFC follows a Model-View-Controller architecture. You can leverage
>
>  that
>
>
>  capability, i.e.:
>
> o your page model provides the initial XForms instances o your page
>
>  view
>
>
>  includes these XForms instances
>
> So create a page model that calls the XPL files that produce these
> instances, and then aggregate them with something like:
>
>  <p:processor name="oxf:identity">
>  <p:input name="data="aggregate('root', #instance1, #instance2,
> #instance3)"/>
>  <p:output name="data" ref="data"/>
>  </p:processor>
>
> Then make sure your page view is an XSLT view (xsl:version="2.0
>
>  attribute on
>
>
>  the root), and include instances as follows:
>
>  <xforms:instance id="instance1">
>  <xsl:copy-of select="/*/*[1]"/>
>  </xforms:instance>
>
>  <xforms:instance id="instance2">
>  <xsl:copy-of select="/*/*[2]"/>
>  </xforms:instance>
>
>  <xforms:instance id="instance3">
>  <xsl:copy-of select="/*/*[3]"/>
>  </xforms:instance>
>
> Ideally, you could also use XInclude to do this, but this would
>
>  require
>
>
>  support for the element() and/or xpointer() schemes which is not
>
>  available
>
>
>  at the moment.
>
> -Erik
>
> --
> 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
>
>
>
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Loading xform dynamically

Erik Bruchez
Administrator
In reply to this post by Pascal Heus
Pascal,

Are you using a recent build? I think that this bug was fixed a while ago.

-Erik

Pascal Heus wrote:

> Alex:
> Tried a few things based on the discussion below:
>
> This work:
> <xforms:instance src="http://localhost:8888/ddi/user/accountForm"/>
>
> But if I try:
> <xforms:instance src="oxf:ddi/user/accountForm"/>
> or <xforms:instance src="oxf:/ddi/user/accountForm"/>
> I get an "xforms:submission: submission URL scheme not supported: oxf"
> error.
>
> Relative URL path seem to fail as well:
> <xforms:instance src="../accountForm"/>
> results in "Response cannot be null"
>
> - The form is loaded in the "http://localhost:8888/ddi/user/account" page
> - /ddi/user/acountForm in the page flow points to a xpl that generates
> the form
> - I'm running ops-3.0.0.200601132127 on Tomcat 4.1 under Eclipse
>
> I may have missed something...?
>
> thanks
> <p/>
>
> Richard Braman wrote:
>> I gues it was the same advice, it was just a littl more confusing.  I
>> was following this thread because I have the same problem.
>>
>> -----Original Message-----
>> From: Richard Braman [mailto:[hidden email]]
>> Sent: Thursday, March 02, 2006 9:13 PM
>> To: [hidden email]
>> Subject: RE: [ops-users] Including multiple external
>> instances/xform:model location in document?
>>
>>
>> I understand that,  I am just saying that this advice differed from the
>> advice Erik gave Alan Skorkin (see message reproduced at bottom).  I
>> think Alan was just trying to accomplish the same thing as Pascal, and
>> your solution makes more sense, to me at least.
>>
>> -----Original Message-----
>> From: [hidden email] [mailto:[hidden email]] On Behalf Of
>> Alessandro Vernet
>> Sent: Thursday, March 02, 2006 9:21 PM
>> To: [hidden email]
>> Subject: Re: [ops-users] Including multiple external
>> instances/xform:model location in document?
>>
>>
>> Richard,
>>
>> To clarify (if at all needed!):
>>
>> If you don't put a scheme in the URI you have in the <xforms:instance
>> src="...">, the URI is relative to the current page, so it will be as is
>> you were requesting this from the browser, which means that your request
>> will hit the page flow controller. This is typically useful when you
>> want to generate an instance dynamically and that you can write the
>> logic to generate that instance in an XPL file.
>>
>> Using a URI of the form oxf:/... is also possible and is typically
>> useful when the instance is static and stored in a separate file.
>>
>> Alex
>>
>> On 3/2/06, Richard Braman <[hidden email]> wrote:
>>  
>>> Wasnt Pascals question this the same baisc question being asked by
>>> Alan Skorkin?
>>>
>>> The answers given by you and Erik were different, but your sounds
>>> better
>>>
>>> Also I remember having a problem with using src="path".  I was
>>> directed to use src="oxf:path/to/file
>>>
>>> but putting it into the page flow seems much easier
>>>
>>>
>>> Alex wrote:
>>>
>>> It looks like you want to load an instance dynamically when the page
>>> is loaded instead of having it defined statically in the XHTML +
>>> XForms file. To do this, you don't need to write any JavaScript. Isn't
>>>    
>>
>>  
>>> that good news? :)
>>>
>>> See for instance the XForms Internationalization example. In
>>> i18n-form.xhtml, you will see: <xforms:instance id="i18n"
>>> src="i18n-resources"/>. This will load the instance from the
>>> "i18n-resources". This is a relative URI which runs i18n-resources.xpl
>>>    
>>
>>  
>>> because there is a <page path-info="/xforms-i18n/i18n-resources"
>>>
>>> model="i18n-resources.xpl"/> in the page flow.
>>>
>>>
>>> -----Original Message-----
>>> From: Alan Skorkin [mailto:[hidden email]]
>>> Sent: Monday, February 20, 2006 8:24 PM
>>> To: '[hidden email]'
>>> Subject: RE: [ops-users] Including multiple external instances
>>>
>>>
>>>
>>> Thanks Erik,
>>>
>>> I'll give this a go!
>>>
>>> -----Original Message-----
>>> From: Erik Bruchez [mailto:[hidden email]]
>>> Sent: Monday, February 20, 2006 11:06 PM
>>> To: [hidden email]
>>> Subject: Re: [ops-users] Including multiple external instances
>>>
>>> Alan Skorkin wrote:
>>>
>>>  > I need to be able to include multiple instances in a view.  >  >
>>> Currently my view includes it's main instance like this:  >
>>>  >         <xforms:instance id="text">
>>>  >                 <xi:include href="input:instance"/>
>>>  >             </xforms:instance>
>>>  >
>>>  > Which works fine, but I need to include possibly several other  >
>>> instances, which are externally produced (i.e. generated  >
>>>    
>> dynamically)  >
>>  
>>>> Ideally I need something along the lines of:
>>>>      
>>>  >
>>>  >         <xforms:instance id="other" src="generate-instance.xpl"/>
>>>  >
>>>  > This doesn't work (I didn't really expect it to :) )
>>>
>>> It is important to realize why it doesn't work: the "src" attribute
>>>    
>> contains
>>  
>>> a URL, relative or not. As explained in another email regarding
>>> xforms:submission/@action, the URL is resolved against xml:base
>>>    
>> attributes
>>  
>>> and if none, against the URL used to request the page.
>>>
>>> So technically, using "generate-instance.xpl" is not illegal, but you
>>>    
>> will
>>  
>>> have to match that in your page flow to get results, create a model
>>>    
>> that
>>  
>>> extracts the name from the URL, loads and execute the pipeline, etc.
>>>    
>> Some
>>  
>>> work to do!
>>>
>>>  > So far we have been able to get the following to work:
>>>  >
>>>  >         <xforms:instance id="other"
>>>  >
>>>
>>>    
>> src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance"/>
>>  
>>>  >
>>>  > Unfortunately we have not been able to get this to work when not
>>>    
>> using  >
>>  
>>> an absolute URL i.e. The following doesn't work  >
>>>
>>>  >         <xforms:instance id="other"
>>> src="/servletToGenerateInstance"/>
>>>  >
>>>  > Even though it should from what I can see in the documentation. The
>>>
>>> question is, why doesn't the above work?
>>>
>>> This should work. Without more information, I cannot say why it
>>>    
>> doesn't in
>>  
>>> your case.
>>>
>>>  > More generally what is the best way for me to include several  >
>>> dynamically generated external instances in my view?
>>>
>>>  > Preferably without going to an external servlet, but if we have to
>>> go to an external servlet, we need access to the same  >
>>> HttpServetRequet object that the OPS servlet has, how can this be  >
>>> done?
>>>
>>> The PFC follows a Model-View-Controller architecture. You can leverage
>>>    
>> that
>>  
>>> capability, i.e.:
>>>
>>> o your page model provides the initial XForms instances o your page
>>>    
>> view
>>  
>>> includes these XForms instances
>>>
>>> So create a page model that calls the XPL files that produce these
>>> instances, and then aggregate them with something like:
>>>
>>>    <p:processor name="oxf:identity">
>>>        <p:input name="data="aggregate('root', #instance1, #instance2,
>>> #instance3)"/>
>>>        <p:output name="data" ref="data"/>
>>>    </p:processor>
>>>
>>> Then make sure your page view is an XSLT view (xsl:version="2.0
>>>    
>> attribute on
>>  
>>> the root), and include instances as follows:
>>>
>>>    <xforms:instance id="instance1">
>>>      <xsl:copy-of select="/*/*[1]"/>
>>>    </xforms:instance>
>>>
>>>    <xforms:instance id="instance2">
>>>      <xsl:copy-of select="/*/*[2]"/>
>>>    </xforms:instance>
>>>
>>>    <xforms:instance id="instance3">
>>>      <xsl:copy-of select="/*/*[3]"/>
>>>    </xforms:instance>
>>>
>>> Ideally, you could also use XInclude to do this, but this would
>>>    
>> require
>>  
>>> support for the element() and/or xpointer() schemes which is not
>>>    
>> available
>>  
>>> at the moment.
>>>
>>> -Erik
>>>
>>> --
>>> 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
>>  
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Loading xform dynamically

Pascal Heus
Erik:
I'm running ops-3.0.0.200601132127. Was this fixed in a later release?
thanks
*P

Erik Bruchez wrote:

> Pascal,
>
> Are you using a recent build? I think that this bug was fixed a while
> ago.
>
> -Erik
>
> Pascal Heus wrote:
>> Alex:
>> Tried a few things based on the discussion below:
>>
>> This work:
>> <xforms:instance src="http://localhost:8888/ddi/user/accountForm"/>
>>
>> But if I try:
>> <xforms:instance src="oxf:ddi/user/accountForm"/>
>> or <xforms:instance src="oxf:/ddi/user/accountForm"/>
>> I get an "xforms:submission: submission URL scheme not supported:
>> oxf" error.
>>
>> Relative URL path seem to fail as well:
>> <xforms:instance src="../accountForm"/>
>> results in "Response cannot be null"
>>
>> - The form is loaded in the "http://localhost:8888/ddi/user/account"
>> page
>> - /ddi/user/acountForm in the page flow points to a xpl that
>> generates the form
>> - I'm running ops-3.0.0.200601132127 on Tomcat 4.1 under Eclipse
>>
>> I may have missed something...?
>>
>> thanks
>> <p/>



--
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: Loading xform dynamically

Erik Bruchez
Administrator
Pascal,

I can't find quickly the answer to this question, so the burden will be
on you to download an unstable build and give it a try. It's easy:
backup your ops.jar and replace it with the new ops.jar contained in
ops.war:

   http://forge.objectweb.org/nightlybuilds/ops/ops/

-Erik

Pascal Heus wrote:

> Erik:
> I'm running ops-3.0.0.200601132127. Was this fixed in a later release?
> thanks
> *P
>
> Erik Bruchez wrote:
>> Pascal,
>>
>> Are you using a recent build? I think that this bug was fixed a while
>> ago.
>>
>> -Erik
>>
>> Pascal Heus wrote:
>>> Alex:
>>> Tried a few things based on the discussion below:
>>>
>>> This work:
>>> <xforms:instance src="http://localhost:8888/ddi/user/accountForm"/>
>>>
>>> But if I try:
>>> <xforms:instance src="oxf:ddi/user/accountForm"/>
>>> or <xforms:instance src="oxf:/ddi/user/accountForm"/>
>>> I get an "xforms:submission: submission URL scheme not supported:
>>> oxf" error.
>>>
>>> Relative URL path seem to fail as well:
>>> <xforms:instance src="../accountForm"/>
>>> results in "Response cannot be null"
>>>
>>> - The form is loaded in the "http://localhost:8888/ddi/user/account"
>>> page
>>> - /ddi/user/acountForm in the page flow points to a xpl that
>>> generates the form
>>> - I'm running ops-3.0.0.200601132127 on Tomcat 4.1 under Eclipse
>>>
>>> I may have missed something...?
>>>
>>> thanks
>>> <p/>
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Loading xform dynamically

Pascal Heus
Erik:
downloaded, replaced, restarted, problem fixed.
merci :-)
*P

Erik Bruchez wrote:

> Pascal,
>
> I can't find quickly the answer to this question, so the burden will
> be on you to download an unstable build and give it a try. It's easy:
> backup your ops.jar and replace it with the new ops.jar contained in
> ops.war:
>
>   http://forge.objectweb.org/nightlybuilds/ops/ops/
>
> -Erik



--
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: Including multiple external instances

Ross Horne
In reply to this post by Erik Bruchez
Erik,

Is there any plan to include XPointer support in the XInclude processor? For situations like Alans (and mine which is similar) it would, as you say, be much more elegant than the XSLT solution and also more versatile.

I attempted to upgrade to Xerces 2.8 but unsurprisingly a straight switch of classes didn't work. Might be a worth while upgrade anyway since the version currently used by ops is over a year old.

Ross.


On 20/02/06, Erik Bruchez <[hidden email]> wrote:
Alan Skorkin wrote:

> I need to be able to include multiple instances in a view.
>
> Currently my view includes it's main instance like this:
>
>         <xforms:instance id="text">
>                 <xi:include href="input:instance"/>
>             </xforms:instance>
>
> Which works fine, but I need to include possibly several other
> instances, which are externally produced ( i.e. generated
> dynamically)
>
> Ideally I need something along the lines of:
>
>         <xforms:instance id="other" src="generate-instance.xpl"/>
>
> This doesn't work (I didn't really expect it to :) )

It is important to realize why it doesn't work: the "src" attribute
contains a URL, relative or not. As explained in another email
regarding xforms:submission/@action, the URL is resolved against
xml:base attributes and if none, against the URL used to request the
page.

So technically, using "generate-instance.xpl" is not illegal, but you
will have to match that in your page flow to get results, create a
model that extracts the name from the URL, loads and execute the
pipeline, etc. Some work to do!

> So far we have been able to get the following to work:
>
>         <xforms:instance id="other"
> src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance "/>
>
> Unfortunately we have not been able to get this to work when not using
> an absolute URL i.e. The following doesn't work
>
>         <xforms:instance id="other" src="/servletToGenerateInstance"/>
>
> Even though it should from what I can see in the documentation. The
> question is, why doesn't the above work?

This should work. Without more information, I cannot say why it
doesn't in your case.

> More generally what is the best way for me to include several
> dynamically generated external instances in my view?

> Preferably without going to an external servlet, but if we have to
> go to an external servlet, we need access to the same
> HttpServetRequet object that the OPS servlet has, how can this be
> done?

The PFC follows a Model-View-Controller architecture. You can leverage
that capability, i.e.:

o your page model provides the initial XForms instances
o your page view includes these XForms instances

So create a page model that calls the XPL files that produce these
instances, and then aggregate them with something like:

   <p:processor name="oxf:identity">
       <p:input name="data="aggregate('root', #instance1, #instance2,
#instance3)"/>
       <p:output name="data" ref="data"/>
   </p:processor>

Then make sure your page view is an XSLT view (xsl:version="2.0
attribute on the root), and include instances as follows:

   <xforms:instance id="instance1">
     <xsl:copy-of select="/*/*[1]"/>
   </xforms:instance>

   <xforms:instance id="instance2">
     <xsl:copy-of select="/*/*[2]"/>
   </xforms:instance>

   <xforms:instance id="instance3">
     <xsl:copy-of select="/*/*[3]"/>
   </xforms:instance>

Ideally, you could also use XInclude to do this, but this would
require support for the element() and/or xpointer() schemes which is
not available at the moment.

-Erik




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





--
telephones
07921 906 453 (mobile)
07879 052 143 (alternative mobile)
01573 225 400 (Kelso)

address
1 Tweedsyde Park
Kelso
Roxburghshire
TD5 7RF

--
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: Including multiple external instances

Erik Bruchez
Administrator
Ross,

Yes it would be good to upgrade to the latest Xerces. I entered a bug to
track this:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=304867&group_id=168&atid=350207

Note that there are two different places where XInclude is handled:

1. At parsing time with Xerces (off by default, you have to use the URL
generator to turn this on).

2. At any time with the XInclude processor.

The latter is used to processed page views. To have enhanced XInclude
support there, you would need to enhance the XInclude processor.

-Erik

Ross Horne wrote:

> Erik,
>
> Is there any plan to include XPointer support in the XInclude processor?
> For situations like Alans (and mine which is similar) it would, as you
> say, be much more elegant than the XSLT solution and also more versatile.
>
> I attempted to upgrade to Xerces 2.8 but unsurprisingly a straight
> switch of classes didn't work. Might be a worth while upgrade anyway
> since the version currently used by ops is over a year old.
>
> Ross.
>
>
> On 20/02/06, *Erik Bruchez* <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Alan Skorkin wrote:
>
>      > I need to be able to include multiple instances in a view.
>      >
>      > Currently my view includes it's main instance like this:
>      >
>      >         <xforms:instance id="text">
>      >                 <xi:include href="input:instance"/>
>      >             </xforms:instance>
>      >
>      > Which works fine, but I need to include possibly several other
>      > instances, which are externally produced ( i.e. generated
>      > dynamically)
>      >
>      > Ideally I need something along the lines of:
>      >
>      >         <xforms:instance id="other" src="generate-instance.xpl"/>
>      >
>      > This doesn't work (I didn't really expect it to :) )
>
>     It is important to realize why it doesn't work: the "src" attribute
>     contains a URL, relative or not. As explained in another email
>     regarding xforms:submission/@action, the URL is resolved against
>     xml:base attributes and if none, against the URL used to request the
>     page.
>
>     So technically, using "generate-instance.xpl" is not illegal, but you
>     will have to match that in your page flow to get results, create a
>     model that extracts the name from the URL, loads and execute the
>     pipeline, etc. Some work to do!
>
>      > So far we have been able to get the following to work:
>      >
>      >         <xforms:instance id="other"
>      >
>     src="http://localhost:8080/oip-forms-viewer/servletToGenerateInstance
>     <http://localhost:8080/oip-forms-viewer/servletToGenerateInstance>"/>
>      >
>      > Unfortunately we have not been able to get this to work when not
>     using
>      > an absolute URL i.e. The following doesn't work
>      >
>      >         <xforms:instance id="other"
>     src="/servletToGenerateInstance"/>
>      >
>      > Even though it should from what I can see in the documentation. The
>      > question is, why doesn't the above work?
>
>     This should work. Without more information, I cannot say why it
>     doesn't in your case.
>
>      > More generally what is the best way for me to include several
>      > dynamically generated external instances in my view?
>
>      > Preferably without going to an external servlet, but if we have to
>      > go to an external servlet, we need access to the same
>      > HttpServetRequet object that the OPS servlet has, how can this be
>      > done?
>
>     The PFC follows a Model-View-Controller architecture. You can leverage
>     that capability, i.e.:
>
>     o your page model provides the initial XForms instances
>     o your page view includes these XForms instances
>
>     So create a page model that calls the XPL files that produce these
>     instances, and then aggregate them with something like:
>
>        <p:processor name="oxf:identity">
>            <p:input name="data="aggregate('root', #instance1, #instance2,
>     #instance3)"/>
>            <p:output name="data" ref="data"/>
>        </p:processor>
>
>     Then make sure your page view is an XSLT view (xsl:version="2.0
>     attribute on the root), and include instances as follows:
>
>        <xforms:instance id="instance1">
>          <xsl:copy-of select="/*/*[1]"/>
>        </xforms:instance>
>
>        <xforms:instance id="instance2">
>          <xsl:copy-of select="/*/*[2]"/>
>        </xforms:instance>
>
>        <xforms:instance id="instance3">
>          <xsl:copy-of select="/*/*[3]"/>
>        </xforms:instance>
>
>     Ideally, you could also use XInclude to do this, but this would
>     require support for the element() and/or xpointer() schemes which is
>     not available at the moment.
>
>     -Erik
>
>
>
>
>     --
>     You receive this message as a subscriber of the
>     [hidden email] <mailto:[hidden email]> mailing list.
>     To unsubscribe: mailto:[hidden email]
>     <mailto:[hidden email]>
>     For general help: mailto: [hidden email]
>     <mailto:[hidden email]>?subject=help
>     ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>
>
>
> --
> telephones
> 07921 906 453 (mobile)
> 07879 052 143 (alternative mobile)
> 01573 225 400 (Kelso)
>
> address
> 1 Tweedsyde Park
> Kelso
> Roxburghshire
> TD5 7RF
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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