Common strings in properties.xml files

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

Common strings in properties.xml files

bwallis42
I have a number of properties that share part of a string, i.e.

<!-- Codeset REST service URL -->
    <property as="xs:string" name="im.webservice.uri.codeset" value="http://localhost:8080/codesetapi/codesets" />

<!-- Eform Letters print service URL -->
    <property as="xs:string" name="im.webservice.uri.eform-letters" value="http://localhost:8080/eform-letters/generate-letter" />

Can I set a property with the value "http://localhost:8080/" and then use it in the values of other properties?
Reply | Threaded
Open this post in threaded view
|

Re: Common strings in properties.xml files

Alessandro  Vernet
Administrator
Hi Brian,

It depends; which other properties do you have in mind? (I am asking, as if those properties support XPath between brackets, aka AVTs, then you might be able to do so.)

Alex
On Tue, Mar 15, 2016 at 9:21 PM bwallis42 <[hidden email]> wrote:
I have a number of properties that share part of a string, i.e.



Can I set a property with the value "http://localhost:8080/" and then use it
in the values of other properties?


--
View this message in context: http://discuss.orbeon.com/Common-strings-in-properties-xml-files-tp4661235.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Common strings in properties.xml files

bwallis42
This post was updated on .
Alessandro Vernet wrote
Hi Brian,

It depends; which other properties do you have in mind? (I am asking, as if
those properties support XPath between brackets, aka AVTs, then you might
be able to do so.)
<!-- base url for REST info server -->
    <property as="xs:string" name="im.webservice.hosturl" value="http://localhost:8080" />
<!-- Codeset REST service URL -->
    <property as="xs:string" name="im.webservice.uri.codeset" value="${im.webservice.hosturl}/codesetapi/codesets" />

I'm consuming these particular values in xbl controls, usually in a submission (this one is not using the codeset property, it is using a similarly defined info property)

                <xf:submission id="get-document-state-history" method="get" replace="instance"
                    instance="document-state-history"
                    action="{xxf:property('im.webservice.uri.info')}/documentstate/{xxf:split(xxf:get-request-path(),'/')[last()]}/history">


so I suppose I could do it there using two properties. Seems a bit messy to me.

So I gather that there is no general way to do this just in the properties to end up with a single property for the value used in the control or in a form?

thanks,
brian.
Reply | Threaded
Open this post in threaded view
|

Re: Common strings in properties.xml files

Alessandro  Vernet
Administrator
Hi Brian,

There is no mechanism to do this at the properties level. But your second property could be defined as:

<property as="xs:string" name="im.webservice.uri.codeset" value="{xxf:property('im.webservice.hosturl')}/codesetapi/codesets"/>

And when referring to its value, from XPath, you'd say: xxf:evaluate-avt(xxf:property('im.webservice.uri.codeset')).

In fact a lot of the Form Runner properties are evaluated as AVTs, which opens a number of possibilities, and the ability to refer to other properties is just one of them.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet