Menu

Calling xpath functions like fn:nilled

Help
2006-08-09
2013-03-22
  • Arnout Engelen

    Arnout Engelen - 2006-08-09

    I have a field that I only want to show if no value has been entered yet in certain other field (which is a yes/no boolean selection).

    I figured this could be done by adding the namespace xmlns:fn="http://www.w3.org/2005/02/xpath-functions" and specifying <xf:bind nodeset="one" relevant="fn:nilled(../other)"/>

    I get a popup that says the `nilled' function is not defined.

    The status page mentions that the XForms Core Functions are supported (7.6), but Extension functions are not (7.12). Is this what I am running into? Would such support be easy to add? If not, is there a way I can work around this limitation?

     
    • AJAXForms

      AJAXForms - 2006-08-09

      To do this you can type : length(../other) > 0

      Function nilled is not defined because XForms implements XPath 1.0, not 2.0 (http://www.w3.org/TR/2006/REC-xforms-20060314/slice7.html#expr-datatypes).

      You can defined new functions in javascript, I will write a document with tips tomorrow.

       
      • Anonymous

        Anonymous - 2007-04-24

        Have you written this tips? I am also trying to call some javascript from XFORM.
        It seems there is a complicate solution using the load element: http://en.wikibooks.org/wiki/XForms/Dynamically_Load_JavaScript
        I didn't tried it yet; I am not sure AjaxForms handle multiple instances very well, at least it didn't worked in this example: http://en.wikibooks.org/wiki/XForms/Binds_to_many_instances (the only output I got was "Model 1" and after "Model 2"

        Thanks

         
    • Arnout Engelen

      Arnout Engelen - 2006-08-15

      <xf:bind nodeset="one" relevant="length(../other)"/> also gives a "Function length not found" popup - or isn't that what you meant? Where/how is this function defined?

      Is AJAXForms expressive enough to be able to express things like "if an integer below 19 is entered at question foo and question bar is either empty or answered with true" for relevancy of other questions?

      Looking forward to an explanation of the extensibility of AJAXForms (or did I miss it?).

       
    • Arnout Engelen

      Arnout Engelen - 2006-08-16

      I worked around this by comparing ../other to the empty string, this seems to work. Is that safe?

      About expressivity: seems like this is supported fine and simple: 'relevance="(../foo < 19) and (../bar != 'false')"'.

       
    • AJAXForms

      AJAXForms - 2006-08-21

      Sorry, function name is string-length. You can see all XPath functions in http://ajaxforms.sourceforge.net/samples/xpath.html .

      The relevance expression is fine.

      Happy codding

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.