How to parametrize src instance attribute?

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

How to parametrize src instance attribute?

richhl
would like to make the src attribute dependant on an input instance tag value, how can I do that in an xhtml file:

for example this:

<xforms:instance id="instancia-respuestas-basfi" src="/exist/rest/db/orbeon/xforms-ehistoria/usuario1/respuestas_basfi.xml"/>

being dependant of login user....

if tried xsl-copy with doc('input:instance') expressions but with no success....

thx a lot

rich




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

Re: How to parametrize src instance attribute?

marc-62
Richard C. Hidalgo Lorite a écrit :
would like to make the src attribute dependant on an input instance tag value, how can I do that in an xhtml file:

for example this:

<xforms:instance id="instancia-respuestas-basfi" src="/exist/rest/db/orbeon/xforms-ehistoria/usuario1/respuestas_basfi.xml"/>

being dependant of login user....

if tried xsl-copy with doc('input:instance') expressions but with no success....

thx a lot

rich


  
Richard,

You cannot use xsl directly with xforms in a xhtml file.
You can send a submission to retrieve the file based on the user at the start of the page with : <xforms:action ev:event="xforms-ready">
In many places you can use AVT but I don't know if it's possible with xforms:instance tag and src attribute.
Try this :
<xforms:instance id="instancia-respuestas-basfi" src="/exist/rest/db/orbeon/xforms-ehistoria/{instance('user')/username}/respuestas_basfi.xml"/>
TIA

Marc

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

Re: How to parametrize src instance attribute?

richhl
> You cannot use xsl directly with xforms in a xhtml file.

In fact, you can...see for example this:

        <!-- Form-specific model -->
        <xsl:copy-of select="doc(concat('../forms/', doc('input:instance')/*/form-id, '/model.xml'))/*"/>
        <!-- Model to handle persistence -->
        <xi:include href="oxf:/apps/forms/common/persistence-model.xml" xxi:omit-xml-base="true"/>
        <!-- Model to handle resources -->
        <xi:include href="oxf:/apps/forms/common/resources-model.xml" xxi:omit-xml-base="true"/>

 in /apps/forms/detail/detail-view.xhtml

> You can send a submission to retrieve the file based on the user at the
> start of the page with : <xforms:action ev:event="xforms-ready">

thx, doing by this I've got it.

> In many places you can use AVT but I don't know if it's possible with
> xforms:instance tag and src attribute.
> Try this :
>
> <xforms:instance id="instancia-respuestas-basfi" src="/exist/rest/db/orbeon/xforms-ehistoria/*{instance('user')/username}*/respuestas_basfi.xml"/>
>

is not possible, expression with braces throws orbeon exception.

is it possible to use AVT in order to parametrize id's of xforms ui controls, for example fix different id's for loop generated select1's?

thx

rich


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

Re: How to parametrize src instance attribute?

Erik Bruchez
Administrator

On Dec 17, 2007, at 9:43 AM, Richard C. Hidalgo Lorite wrote:

>> You cannot use xsl directly with xforms in a xhtml file.
>
> In fact, you can...see for example this:
>
>        <!-- Form-specific model -->
>        <xsl:copy-of select="doc(concat('../forms/',  
> doc('input:instance')/*/form-id, '/model.xml'))/*"/>
>        <!-- Model to handle persistence -->
>        <xi:include href="oxf:/apps/forms/common/persistence-
> model.xml" xxi:omit-xml-base="true"/>
>        <!-- Model to handle resources -->
>        <xi:include href="oxf:/apps/forms/common/resources-model.xml"  
> xxi:omit-xml-base="true"/>
>
> in /apps/forms/detail/detail-view.xhtml
For this to work, you need an xsl:version="2.0" attribute on the root  
element on the page. Do you have this?

>> You can send a submission to retrieve the file based on the user at  
>> the
>> start of the page with : <xforms:action ev:event="xforms-ready">
>
> thx, doing by this I've got it.
>
>> In many places you can use AVT but I don't know if it's possible with
>> xforms:instance tag and src attribute.
>> Try this :
>>
>> <xforms:instance id="instancia-respuestas-basfi" src="/exist/rest/
>> db/orbeon/xforms-ehistoria/*{instance('user')/username}*/
>> respuestas_basfi.xml"/>
>>
>
> is not possible, expression with braces throws orbeon exception.
Right, this won't work, because AVTs in XForms require that all XForms  
instances have been initialized.

However, if you use XSLT, then you will be able to use AVTs and the  
doc('input:instance') function.

Or, as already suggested, you can use a submission upon xforms-ready  
to populate the instance dynamically. At Orbeon, we often do this:

   <xforms:instance id="parameters-instance" src="input:instance"/>

Then upon xforms-ready you can use the contents of this parameters  
instance to perform a submission which will load the correct data.

> is it possible to use AVT in order to parametrize id's of xforms ui  
> controls, for example fix different id's for loop generated select1's?

By "loop-generated", do you mean produced by xforms:repeat?  
xforms:repeat will automatically assign different ids to the resulting  
HTML controls, so you don't have to do anything special.

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



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