evaluate xpath in regular xhtml tags

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

evaluate xpath in regular xhtml tags

Henk Visser
Hi there,

I would like to have the href tag of an html link tag rendered dynamically, using an expression orbeon should evaluate. Like so:

<a href="{some expression orbeon can evaluate}">label should become label

However Orbeon-runner seems only to evaluate expressions that are placed in xform or orbeon-xform tags. The above link tag stays exactly like it is after being processed by the form-runner in my Orbeon setup. Thus:
<a href="{some expression orbeon can evaluate}">label stays <a href="{some expression orbeon can evaluate}">label

Do I have to configure something particular in order to get orbeon also evaluate expression outside xform or obeon-xform tags?

Thanks in advance and kind regards,

Henk
Reply | Threaded
Open this post in threaded view
|

Re: evaluate xpath in regular xhtml tags

Alessandro  Vernet
Administrator
Reply | Threaded
Open this post in threaded view
|

Re: evaluate xpath in regular xhtml tags

Henk Visser
Hi Alex,

Thanks for your reply. Beneath you'ĺl find the piece of code that uses the xpath expression in the link element. Funny thing is that I took the code from another application in which the xpath expression does get resolved. I my application unfortunately it doesn't. Maybe I have to set some setting in order to get the xpath evaluated. I use Orbeon 4, by the way.

    <xforms:switch id="switch-errors">
      <xforms:case id="default" selected="true"/>
      <xforms:case id="show-errors" selected="false">
        <ul class="important section errormessages">
          <xxforms:variable id="invalid-binds" name="invalid-binds" select="for $node in instance('is-employee')//(node()|@*) return xxforms:invalid-binds($node)"/>
          <xforms:repeat id="validation-errors-repeat" nodeset="if (count($invalid-binds) gt 0) then xxforms:sort($invalid-binds, ., 'text','ascending') else ('unknown-error')">
            <xxforms:variable name="invalid-bind" select="."/>
            <li>
              <a href="#{instance('texts')/resource[@key = $invalid-bind]/@field}">  
                <xforms:output id="validation-error-message" value="instance('texts')/resource[@key = $invalid-bind]"/>
             
            </li>
          </xforms:repeat>
        </ul>
      </xforms:case>
    </xforms:switch> 

Thanks again and kind regards,

Henk
Reply | Threaded
Open this post in threaded view
|

Re: evaluate xpath in regular xhtml tags

Alessandro  Vernet
Administrator
Hi Henk,

I am trying this, and it is working for me. For instance, this example works for me: view.xhtml. Is it working for you as well? If it is, but you have another that doesn't work, could you make it as simple as possible and attach it?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: evaluate xpath in regular xhtml tags

Henk Visser
Hi Alex,

The expression in the view.xhtml you supplied doesn't work in my application neither. The application I'm working on makes use of a stylesheet (xsl) for templating. However, if I leave that stylesheet out xpath expressions like the one you supplied still don't get evaluated. Might there be some setting that should or perhaps shouldn´t be set in order to get xpath expressions working?

Thanks and kind regards,

Rienk
Reply | Threaded
Open this post in threaded view
|

Re: evaluate xpath in regular xhtml tags

Alessandro  Vernet
Administrator
Hi Henk,

Maybe XSLT is interpreting that AVT, before it gets to Orbeon Forms. Can you try doubling the curly brackets, as in <a href="#{{instance('texts')/resource[@key = $invalid-bind]/@field}}">?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: evaluate xpath in regular xhtml tags

Henk Visser
Hi Alex,

Thanks for your suggestion. I tried doubbling the curly brackets, but still the expression isn't resolved. Perhaps  indeed the XSLT translation gets in the way. I'll have a look at that.

Best regards,

Henk
Reply | Threaded
Open this post in threaded view
|

Re: evaluate xpath in regular xhtml tags

Alessandro  Vernet
Administrator
Hi Henk,

Alright, and if you think this is a bug, feel free to send us some code we can run here, making the code as simple as possible, to make it easier to figure out on our end.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: evaluate xpath in regular xhtml tags

Henk Visser
Hi Alex,

If I include the properties-base.xml and properties-xforms.xml in our properties-local.xml then the xpath gets resolved.

However these files effect other stuff as well, unintentionally. I've had a look at the properties-base.xml and properties-xforms.xml and they saw that they contain dozens of properties. Could you tell me which ones make resolving xpath expressions work?

Best regards,

Rienk
Reply | Threaded
Open this post in threaded view
|

Re: evaluate xpath in regular xhtml tags

Henk Visser
I've put the property beneath in the proprties-local.xml and now it works:

      <property as="xs:boolean" name="oxf.xforms.host-language-avts"   value="true"/> 

Best regards,

Henk
Reply | Threaded
Open this post in threaded view
|

Re: evaluate xpath in regular xhtml tags

Alessandro  Vernet
Administrator
Hi Henk,

I am glad this solves your problem, but setting oxf.xforms.host-language-avts to true shouldn't make a difference, as this is the default value, defined in properties-xforms.xml. Is the default defined differently in your properties-xforms.xml?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: evaluate xpath in regular xhtml tags

Henk Visser
Hi Alex,

The property is set to true in the properties-xforms.xml, but perhaps in the way we setup everything that properties file isn't being used.

Best regards,

Henk